当前位置:网站首页>~1 CCF 2022-06-2 treasure hunt! Big adventure!
~1 CCF 2022-06-2 treasure hunt! Big adventure!
2022-07-25 09:39:00 【Ye Xiaobai】
Treasure hunt ! Great adventure !
Title Description

Input

Output

The sample input
Example 1 :
5 100 2
0 0
1 1
2 2
3 3
4 4
0 0 1
0 1 0
1 0 0
Example 2 :
5 4 2
0 0
1 1
2 2
3 3
4 4
0 0 0
0 1 0
1 0 0
Sample output
Example 1 :
3
Example 2 :
0
The subtasks

Source code
#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 the matrix starting at the current point is not enough to contain the entire treasure map
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;
}
About this problem
1. Note the subscript of the matrix , Not in order .
2. When code is submitted , choice CPP11 or CPP14
3. The current point cannot correspond to the lower left corner of the treasure map in three cases :
(1) The matrix starting at the current point is not enough to contain the entire treasure map
(2) There is a tree somewhere in the treasure map , There is no tree in the corresponding position in the map
(3) There are trees at some point in the map , There is no tree in the corresponding position of the treasure map
边栏推荐
- TCP network application development process
- [code source] daily one question non decreasing 01 sequence
- ## 使用 Kotlin USE 简化文件读写
- *6-2 CCF 2015-03-3 Festival
- 基于树莓派4b的传感器数据可视化实现
- 为什么要使用JSON.stringify()和JSON.parse()
- [code source] I have a big head for a problem every day
- OC -- category extension agreement and delegation
- [code source] daily question simple fields and
- The jar package has been launched on Alibaba cloud server and the security group has been opened, but postman still can't run. What should we do
猜你喜欢
随机推荐
*6-1 CCF 2015-03-2 numerical sorting
OC--Foundation--数组
相机姿态估计
Class (2) and protocol
Machine learning -- detailed introduction of standardscaler (), transform (), fit () in sklearn package
Android & Kotlin : 困惑解答
Kotlin 实现文件下载
[De1CTF 2019]SSRF Me
*6-3 save small experts
Jar包在阿里云服务器起起来了,安全组也开通了,但postman仍跑不通怎么办
How to customize the title content of uni app applet (how to solve the problem that the title of applet is not centered)
Database operation language (DML)
[code source] add brackets to the daily question
Singleton mode
Data query language (DQL)
【代码源】每日一题 树
OC--Foundation--字典
*7-1 CCF 2015-09-1 数列分段
换电脑后如何配置SSH
打造个人极限写作流程 -转载



![[De1CTF 2019]SSRF Me](/img/12/44c37cc713b49172a10579c9628c94.png)





