当前位置:网站首页>~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)地图中某点有树,藏宝图对应位置没有树
边栏推荐
- [WSN communication] optimize HWSN energy-saving clustering protocol based on MATLAB biogeography [including Matlab source code, 1989]
- PHP网站设计思路
- Detailed explanation of pipeline pipeline mechanism in redis
- 数据控制语言(DCL)
- Notes on in-depth analysis of C language 1
- The difference between abstract classes and interfaces (the most detailed)
- Query efficiency increased by 10 times! Three optimization schemes to help you solve the deep paging problem of MySQL
- Common tool classes under JUC package
- Unable to start debugging on the web server, the web server failed to find the requested resource
- [GKCTF 2021]easynode
猜你喜欢

ActiveMQ -- JDBC Journal of persistent mechanism

Idea hot deployment

Nacos搭建配置中心出现client error: invalid param. endpoint is blank

Shell script

卷积神经网络的兴趣简单介绍

Week小结
![[WSN communication] optimize HWSN energy-saving clustering protocol based on MATLAB biogeography [including Matlab source code, 1989]](/img/47/c804acc3f8de1f0cd5938c3d889e46.png)
[WSN communication] optimize HWSN energy-saving clustering protocol based on MATLAB biogeography [including Matlab source code, 1989]
![[GYCTF2020]Node Game](/img/8d/7e6c2fb2a0359298fbcc1cd8544710.png)
[GYCTF2020]Node Game

Bi business interview with data center and business intelligence (I): preparation for Industry and business research

数据控制语言(DCL)
随机推荐
数据控制语言(DCL)
MySQL排序
Redis数据库基础
office文件对应的Content-Type类型
将list集合的某一字段拼接单个String
uni-app - Refused to display ‘xxx‘ in a frame because an ancestor violates the following Content Sec
[buuctf-n1book][Chapter 2 advanced web]ssrf training
一文搞懂try、catch、finally(包含return)执行流程(全网最详细解析)
『每日一问』简单聊聊JMM/说说对JMM的了解
excl批量导入数据,后台公共解析方法
[GYCTF2020]Ez_Express
Detailed explanation of pipeline pipeline mechanism in redis
Thymeleaf 笔记
『每日一问』volatile干嘛的
ActiveMQ -- leveldb of persistence mechanism
MySQL的索引、视图与事务
Bi business interview with data center and business intelligence (I): preparation for Industry and business research
SSM框架整合,简单案例
Jspdf generates PDF files. There is a problem of incomplete files. Files are downloaded in the background, but not in the foreground
sqli-labs Basic Challenges Less1-10