当前位置:网站首页>~1 ccf 2022-06-2 寻宝!大冒险!
~1 ccf 2022-06-2 寻宝!大冒险!
2022-07-25 09:19:00 【叶萧白】
题目描述

输入

输出

样例输入
样例一:
5 100 2
0 0
1 1
2 2
3 3
4 4
0 0 1
0 1 0
1 0 0
样例二:
5 4 2
0 0
1 1
2 2
3 3
4 4
0 0 0
0 1 0
1 0 0
样例输出
样例一:
3
样例二:
0
子任务

源代码
#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main() {
int n, L, s;
cin >> n >> L >> s;
vector<pair<int, int>> v(n);
set<pair<int, int>> set;
for (int i = 0; i < n; i++) {
cin >> v[i].first >> v[i].second;
set.insert(v[i]);
}
vector<vector<int>> f(s + 1, vector<int>(s + 1));
for (int i = s; i >= 0; i--) {
for (int j = 0; j <= s; j++) {
cin >> f[i][j];
}
}
int ret = 0;
for (int i = 0; i < n; i++) {
int r = v[i].first;
int c = v[i].second;
bool check = true;
// 若当前点开始的矩阵不足以包含整个藏宝图
if (r + s > L || c + s > L)
check = false;
for (int j = r, tr = 0; j <= r + s && check && tr <= s; j++, tr++) {
for (int k = c, tc = 0; k <= c + s && check && tc <= s; k++, tc++) {
if (f[tr][tc]) {
if (set.find({
j, k}) == set.end()) {
check = false;
}
} else {
if (set.find({
j, k}) != set.end()) {
check = false;
}
}
}
}
if (check)
ret++;
}
cout << ret;
return 0;
}
关于这题
1.注意矩阵的下标,不是按着顺序来的。
2.提交代码时,选择CPP11或CPP14
3.当前点不能与藏宝图左下角对应分三种情况:
(1)当前点开始的矩阵不足以包含整个藏宝图
(2)藏宝图中某点有树,地图中对应位置没有树
(3)地图中某点有树,藏宝图对应位置没有树
边栏推荐
- 前台页面打印
- Programmers can't SQL? Ashes Engineer: all waiting to be eliminated! This is a must skill!
- DVWA练习一 暴力破解
- redis的五种数据结构原理分析
- PHP网站设计思路
- uni-app - Refused to display ‘xxx‘ in a frame because an ancestor violates the following Content Sec
- nacos2.1.0集群搭建
- Redis sentry, master-slave deployment details
- OverTheWire-Natas
- How can technologists start their personal brand? Exclusive teaching of top five KOLs
猜你喜欢
![[buuctf-n1book][Chapter 2 advanced web]ssrf training](/img/29/8894d04b27e0e73c4458c27bd9b935.png)
[buuctf-n1book][Chapter 2 advanced web]ssrf training

Guangzhou has carried out in-depth "100 day action" to check the safety of self built commercial houses, and more than 2 million houses have been checked in two months

activemq--可持久化机制之JDBC代码
![[De1CTF 2019]SSRF Me](/img/12/44c37cc713b49172a10579c9628c94.png)
[De1CTF 2019]SSRF Me

idea实用tips---如今将pom.xml(红色)改为pom.xml(蓝色)

sqli-labs Basic Challenges Less1-10

How can technologists start their personal brand? Exclusive teaching of top five KOLs

TCP网络应用程序开发流程

『怎么用』代理模式

Bi business interview with data center and business intelligence (I): preparation for Industry and business research
随机推荐
『怎么用』代理模式
[C language] dynamic memory management, flexible array
How can technologists start their personal brand? Exclusive teaching of top five KOLs
mysql中的数据结果排名
nacos2.1.0集群搭建
log4j2基础配置
registration status: 204
Redis的十大常见应用场景
uni-app - Refused to display ‘xxx‘ in a frame because an ancestor violates the following Content Sec
CentOS changes MySQL database directory
C#语言和SQL Server数据库技术
Leetcode-238. product of arrays other than itself
redis的五种数据结构原理分析
activemq--可持久化机制之JDBC
Redis sentry, master-slave deployment details
粗柳簸箕细柳斗,谁嫌爬虫男人丑 之 异步协程半秒扒光一本小说
Nacos启动报错Unable to start web server
Flask SSTI注入学习
卷积神经网络的兴趣简单介绍
&lt; T&gt; Generic method demonstration