当前位置:网站首页>CCF window (Full Score code + problem solving idea) March 2, 2014
CCF window (Full Score code + problem solving idea) March 2, 2014
2022-06-30 14:40:00 【A cute little monkey】
Problem description

Their thinking :
The data range is very small , So direct pure simulation
Store the window in an array , Query whether the point is in the window from the top down each time , If in , Then the current window is output id, And put the window on the top
Code implementation
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 20;
int n, m;
struct windou
{
int x1, y1, x2, y2;
int id;
}w[N];
int Find(int x, int y) // Judge (x, y) In which window
{
for (int i = n; i > 0; i --)
{
if(x >= w[i].x1 && x <= w[i].x2 && y >= w[i].y1 && y <= w[i].y2)
return i;
}
return -1;
}
void Move(int id) // Top the current window
{
auto temp = w[id];
for (int i = id; i < n; i ++)
{
w[i] = w[i + 1];
}
w[n] = temp;
}
int main()
{
cin >> n >> m;
for (int i = 1; i <= n; i ++)
{
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
w[i] = {
x1, y1, x2, y2, i}; // Structure initialization
}
while (m --)
{
int x, y;
cin >> x >> y;
int res = Find(x, y);
if(res == -1)
{
cout << "IGNORED" << endl;
}
else
{
cout << w[res].id << endl;
Move(res);
}
}
return 0;
}
边栏推荐
- 中信期货开户麻烦吗安全吗,期货开户手续费是多少,能优惠吗
- V3 01_ Welcome
- Double pointer letter matching
- An error is reported when installing dataspherestudio doc: invalid default value for 'update_ time‘
- ThinkPHP v3.2 comment annotation injection write shell
- Introduction to the construction and development of composer private warehouse
- Laravel upload error
- [extensive reading of papers] multimodal attribute extraction
- Uniapp upload image method
- Summary of FTP network protocol learning
猜你喜欢

Att & CK red team evaluation field (I)

Go language mutex lock

Shangpinhui knowledge points of large e-commerce projects

Querywrapper in mybaits plus

About the problems encountered when using the timer class to stop with a button (why does the QPushButton (for the first time) need to be clicked twice to respond?)

PS cutting height 1px, Y-axis tiling background image problem
![[extensive reading of papers] multimodal attribute extraction](/img/ec/546c107ac0d31deded7ca94fdf0e2d.jpg)
[extensive reading of papers] multimodal attribute extraction

Zend studio how to import an existing project

2021 geek challenge Web

Notes on reverse learning in the first week of winter vacation
随机推荐
1 figure to explain the difference and connection between nodejs and JS
Wechat applet realizes map navigation + door-to-door recycling
Race of golang
Double pointer palindrome string
2021-07-15Caused by: org. quartz. ObjectAlreadyExistsException: Unable to store Job : ‘DEFAULT. TASK_ 1‘
JS time conversion standard format, timestamp conversion standard format
Initial attack and defense world Misc
2021 geek challenge Web
Error $(...) size is not a function
Is it troublesome for CITIC futures to open an account? Is it safe? How much is the handling charge for opening an account for futures? Can you offer a discount
Realize a simple LAN communication (similar to feiqiu)
Fastcgi CGI shallow understanding
go channel && select
Solve the error in my QT_ thread_ global_ End(): 3 threads didn't exit
NoViableAltException([email protected][])
[extensive reading of papers] multi modal sarcasm detection and human classification in code mixed conversations
Alipay certificate mode payment interface
ES6 notes
Wuenda 2022 machine learning special course evaluation is coming!
Implement a long-click list pop-up box on apiccloud