# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1033760 |
2024-07-25T05:06:33 Z |
김은성(#10970) |
Tiles (BOI24_tiles) |
C++17 |
|
33 ms |
15264 KB |
#define x first
#define y second
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[1009][1009];
bool impos[1009];
ll ccw(pair<ll, ll> p, pair<ll, ll> q, pair<ll, ll> r){
return (q.x-p.x)*(r.y-p.y) + (r.x-p.x)*(q.y-p.y);
}
int main(){
int n, xm, ym = 1000, i, j;
scanf("%d %d", &n, &xm);
vector<pair<int, int> > p(n);
for(i=0; i<n; i++)
scanf("%d %d", &p[i].x, &p[i].y);
if(ccw(p[0], p[1], p[2]) < 0){
for(i=0; i<n/2; i++)
swap(p[i], p[n-1-i]);
}
for(i=0; i<n; i++){
int x1 = p[i].first, y1 = p[i].second;
int x2 = p[(i+1)%n].first, y2 = p[(i+1)%n].second;
if(y1 == y2){
if(x1 < x2){
for(j=x1; j<x2; j++)
a[j][y1]--;
}
else{
for(j=x1-1; j>=x2; j--)
a[j][y2]++;
}
}
}
for(i=0; i<=xm; i++){
for(j=0; j<=ym; j++){
a[i][j] += (j==0 ? 0 : a[i][j-1]);
//printf("%d", a[i][j]);
}
//printf("\n");
}
bool flag = 0;
for(i=0; i<=xm; i++){
int cur = 0;
for(j=0; j<=ym; j++){
if(!a[i][j]){
if(cur%2 == 1){
flag = 1;
break;
}
cur = 0;
}
else
cur++;
}
if(flag)
impos[i] = 1;
}
for(i=0; i<=ym; i++){
int cur = 0;
bool flag = 0;
for(j=0; j<=xm; j++){
if(!a[j][i]){
if(cur%2==1)
flag = 1;
cur = 0;
}
else
cur++;
if(flag || cur%2)
impos[j] = 1;
}
}
int opt = 0;
for(i=0; i<xm; i++){
if(!impos[i])
opt = i+1;
}
printf("%d\n", opt);
return 0;
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
13 | scanf("%d %d", &n, &xm);
| ~~~~~^~~~~~~~~~~~~~~~~~
Main.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
16 | scanf("%d %d", &p[i].x, &p[i].y);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
4184 KB |
Output is correct |
2 |
Runtime error |
9 ms |
9052 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
4 ms |
4188 KB |
Output is correct |
5 |
Correct |
23 ms |
5724 KB |
Output is correct |
6 |
Correct |
24 ms |
5792 KB |
Output is correct |
7 |
Correct |
4 ms |
4188 KB |
Output is correct |
8 |
Correct |
4 ms |
3932 KB |
Output is correct |
9 |
Correct |
4 ms |
4184 KB |
Output is correct |
10 |
Correct |
5 ms |
4444 KB |
Output is correct |
11 |
Correct |
4 ms |
4188 KB |
Output is correct |
12 |
Correct |
4 ms |
4188 KB |
Output is correct |
13 |
Correct |
4 ms |
4188 KB |
Output is correct |
14 |
Correct |
4 ms |
4188 KB |
Output is correct |
15 |
Correct |
4 ms |
4176 KB |
Output is correct |
16 |
Correct |
4 ms |
4188 KB |
Output is correct |
17 |
Correct |
22 ms |
5724 KB |
Output is correct |
18 |
Correct |
23 ms |
5600 KB |
Output is correct |
19 |
Correct |
5 ms |
4440 KB |
Output is correct |
20 |
Correct |
3 ms |
2652 KB |
Output is correct |
21 |
Correct |
2 ms |
2140 KB |
Output is correct |
22 |
Correct |
2 ms |
2652 KB |
Output is correct |
23 |
Correct |
1 ms |
600 KB |
Output is correct |
24 |
Correct |
4 ms |
4372 KB |
Output is correct |
25 |
Correct |
4 ms |
3896 KB |
Output is correct |
26 |
Correct |
1 ms |
1628 KB |
Output is correct |
27 |
Correct |
3 ms |
3932 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
2 ms |
1884 KB |
Output is correct |
31 |
Correct |
2 ms |
1884 KB |
Output is correct |
32 |
Correct |
3 ms |
3164 KB |
Output is correct |
33 |
Correct |
5 ms |
4188 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
3 ms |
3164 KB |
Output is correct |
37 |
Correct |
3 ms |
3420 KB |
Output is correct |
38 |
Correct |
4 ms |
4188 KB |
Output is correct |
39 |
Correct |
3 ms |
2652 KB |
Output is correct |
40 |
Correct |
4 ms |
4188 KB |
Output is correct |
41 |
Correct |
3 ms |
3772 KB |
Output is correct |
42 |
Correct |
0 ms |
348 KB |
Output is correct |
43 |
Correct |
0 ms |
348 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
0 ms |
348 KB |
Output is correct |
46 |
Correct |
3 ms |
3520 KB |
Output is correct |
47 |
Correct |
2 ms |
1628 KB |
Output is correct |
48 |
Correct |
4 ms |
4188 KB |
Output is correct |
49 |
Correct |
24 ms |
7248 KB |
Output is correct |
50 |
Correct |
22 ms |
7256 KB |
Output is correct |
51 |
Correct |
24 ms |
7240 KB |
Output is correct |
52 |
Correct |
24 ms |
7112 KB |
Output is correct |
53 |
Correct |
3 ms |
3676 KB |
Output is correct |
54 |
Correct |
0 ms |
348 KB |
Output is correct |
55 |
Correct |
5 ms |
4440 KB |
Output is correct |
56 |
Correct |
6 ms |
4444 KB |
Output is correct |
57 |
Correct |
2 ms |
2396 KB |
Output is correct |
58 |
Correct |
0 ms |
348 KB |
Output is correct |
59 |
Correct |
3 ms |
2908 KB |
Output is correct |
60 |
Correct |
1 ms |
348 KB |
Output is correct |
61 |
Correct |
1 ms |
348 KB |
Output is correct |
62 |
Correct |
0 ms |
348 KB |
Output is correct |
63 |
Correct |
5 ms |
4188 KB |
Output is correct |
64 |
Correct |
5 ms |
4444 KB |
Output is correct |
65 |
Correct |
3 ms |
3420 KB |
Output is correct |
66 |
Correct |
4 ms |
4188 KB |
Output is correct |
67 |
Correct |
4 ms |
4188 KB |
Output is correct |
68 |
Incorrect |
4 ms |
4404 KB |
Output isn't correct |
69 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
33 ms |
15264 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |