# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
227475 |
2020-04-27T14:14:47 Z |
cgiosy |
None (KOI17_cut) |
C++17 |
|
644 ms |
44412 KB |
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
int N, sx, sy, px, py, qx;
cin>>N>>sx>>sy; px=qx=sx, py=sy;
set<int> A;
for(int i=N; i--;) {
int x, y;
if(i) cin>>x>>y;
else x=sx, y=sy;
if((y>0)!=(py>0) || !i && (y>0 && py>0)) {
if((!i || y<0) && qx!=x && !A.count(qx*2) && !A.count(qx*2+1) && !A.count(x*2) && !A.count(x*2+1)) {
A.insert(min(qx, x)*2);
A.insert(max(qx, x)*2+1);
}
qx=x;
}
px=x, py=y;
}
int a=0, b=0, c=0, p=0;
for(int x:A) {
if(x%2) a+=!--c, b+=!p, p=1;
else c++, p=0;
}
cout<<a<<' '<<b;
}
Compilation message
cut.cpp: In function 'int main()':
cut.cpp:14:26: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if((y>0)!=(py>0) || !i && (y>0 && py>0)) {
~~~^~~~~~~~~~~~~~~~
cut.cpp:7:17: warning: variable 'px' set but not used [-Wunused-but-set-variable]
int N, sx, sy, px, py, qx;
^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
6 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
6 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
512 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
6 ms |
384 KB |
Output is correct |
19 |
Correct |
9 ms |
640 KB |
Output is correct |
20 |
Correct |
10 ms |
768 KB |
Output is correct |
21 |
Correct |
9 ms |
768 KB |
Output is correct |
22 |
Correct |
10 ms |
768 KB |
Output is correct |
23 |
Correct |
9 ms |
768 KB |
Output is correct |
24 |
Correct |
10 ms |
768 KB |
Output is correct |
25 |
Correct |
9 ms |
640 KB |
Output is correct |
26 |
Correct |
9 ms |
640 KB |
Output is correct |
27 |
Correct |
9 ms |
768 KB |
Output is correct |
28 |
Correct |
9 ms |
768 KB |
Output is correct |
29 |
Correct |
10 ms |
768 KB |
Output is correct |
30 |
Correct |
10 ms |
768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
6 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
512 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
6 ms |
384 KB |
Output is correct |
19 |
Correct |
9 ms |
640 KB |
Output is correct |
20 |
Correct |
10 ms |
768 KB |
Output is correct |
21 |
Correct |
9 ms |
768 KB |
Output is correct |
22 |
Correct |
10 ms |
768 KB |
Output is correct |
23 |
Correct |
9 ms |
768 KB |
Output is correct |
24 |
Correct |
10 ms |
768 KB |
Output is correct |
25 |
Correct |
9 ms |
640 KB |
Output is correct |
26 |
Correct |
9 ms |
640 KB |
Output is correct |
27 |
Correct |
9 ms |
768 KB |
Output is correct |
28 |
Correct |
9 ms |
768 KB |
Output is correct |
29 |
Correct |
10 ms |
768 KB |
Output is correct |
30 |
Correct |
10 ms |
768 KB |
Output is correct |
31 |
Correct |
104 ms |
8952 KB |
Output is correct |
32 |
Correct |
513 ms |
35508 KB |
Output is correct |
33 |
Correct |
113 ms |
8824 KB |
Output is correct |
34 |
Correct |
430 ms |
33964 KB |
Output is correct |
35 |
Correct |
497 ms |
43800 KB |
Output is correct |
36 |
Correct |
510 ms |
43896 KB |
Output is correct |
37 |
Correct |
644 ms |
44408 KB |
Output is correct |
38 |
Correct |
526 ms |
43512 KB |
Output is correct |
39 |
Correct |
601 ms |
44412 KB |
Output is correct |
40 |
Correct |
422 ms |
32584 KB |
Output is correct |
41 |
Correct |
410 ms |
32248 KB |
Output is correct |
42 |
Correct |
540 ms |
42616 KB |
Output is correct |
43 |
Correct |
532 ms |
42360 KB |
Output is correct |
44 |
Correct |
503 ms |
42232 KB |
Output is correct |
45 |
Correct |
525 ms |
42608 KB |
Output is correct |