当前位置:网站首页>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_ Chrome extended Chinese translation document V3 directory
- val_ Loss decreases first and then increases or does not decrease but only increases
- 【BUUCTF】[GXYCTF2019]Ping Ping Ping1
- [buuctf] [actf2020 freshman competition]exec1
- Details of gets, fgetc, fgets, Getc, getchar, putc, fputc, putchar, puts, fputs functions
- After the MySQL service on the local computer is started and stopped, some services will automatically stop when they are not used by other services or programs
- Add attributes to multimode
- August 24, 2021 deque queue and stack
- Cost forecast of PMP (BAC, EAC, etc)
- The difference between settimeout() and setinterval()
猜你喜欢
Not satisfied with markdown native code block style? Try this beautify code screenshot tool~~
ES6 notes
2021 geek challenge Web
val_ Loss decreases first and then increases or does not decrease but only increases
Ctfshow getting started with the web (ThinkPHP topic)
Summary of use of laravel DCAT admin
Component communication mode
KnightCTF WEB
Solve the error in my QT_ thread_ global_ End(): 3 threads didn't exit
XSS challenge (6-10) more detailed answers
随机推荐
數據恢複軟件EasyRecovery15下載
JS time conversion standard format, timestamp conversion standard format
Non decreasing column
PS cutting height 1px, Y-axis tiling background image problem
Crypto questions
DefCamp Capture the Flag (D-CTF) 2021-22 web
从控制层返回到js的json数据带“\”转译符,怎么去掉
KnightCTF WEB
2021-07-14 mybaitsplus
For loop and promise to solve the problem of concurrent callback
The difference between settimeout() and setinterval()
Problem: wechat developer tool visitor mode cannot use this function
PHP reverses scenarios based on code and skillfully uses debug_ backtrace()
DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703
[buuctf] [actf2020 freshman competition]include
【BUUCTF】[GXYCTF2019]Ping Ping Ping1
An error is reported when installing dataspherestudio doc: invalid default value for 'update_ time‘
Laravel artist command error
[extensive reading of papers] multi modal sarcasm detection and human classification in code mixed conversations
Pseudocode writing specification