当前位置:网站首页>~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
边栏推荐
- About C and OC
- [code source] daily one question non decreasing 01 sequence
- Install MySQL in Ubuntu and create new users
- 本地存储待办事项(在待办事项上进行改进)
- Learn redis Linux and install redis
- 【代码源】每日一题 国家铁路
- 【cf】Round 128 C. Binary String
- How many regions can a positive odd polygon be divided into
- [GPLT] 2022 大众情人(floyd)
- UI - infinite rotation chart and column controller
猜你喜欢

解决esp8266无法连接手机和电脑热点的问题

类(2) 和 协议

Object initialization

如何将其他PHP版本添加到MAMP

Install MySQL in Ubuntu and create new users

Definition of cell

Stm32+hc05 serial port Bluetooth design simple Bluetooth speaker
![[GYCTF2020]Ez_ Express](/img/ce/02b90708f215715bb53cacfd4c21f0.png)
[GYCTF2020]Ez_ Express

How to customize the title content of uni app applet (how to solve the problem that the title of applet is not centered)

How to convert object data into arrays
随机推荐
SurfaceView 闪屏(黑一下问题)
Laravel calls a third party to send mail (PHP)
Voice chat app source code - produced by NASS network source code
相机姿态估计
单例模式(Singleton)
深入解读C语言随机数函数和如何实现随机数
laravel 调用第三方 发送邮件 (php)
[GYCTF2020]Node Game
打造个人极限写作流程 -转载
UI——无限轮播图和分栏控制器
[code source] I have a big head for a problem every day
[code source] daily question simple fields and
微信小程序初步了解及实现底部导航栏
如何将Jar包部署到服务器,注:启动命令有无nohup有很大关系
正奇边形可划分成多少区域
【代码源】每日一题 分割(nlogn&n解法)
UI原型资源
自定义Dialog 实现 仿网易云音乐的隐私条款声明弹框
语音聊天app源码-钠斯网络源码出品
关于学生管理系统(注册,登录,学生端)