# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
227466 |
2020-04-27T13:43:16 Z |
cgiosy |
None (KOI17_cut) |
C++17 |
|
6 ms |
384 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;
vector<int> A;
A.reserve(N/2+2);
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.push_back(min(qx, x)*2);
A.push_back(max(qx, x)*2+1);
}
qx=x;
}
px=x, py=y;
}
sort(begin(A), end(A));
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:15:26: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if((y>0)!=(py>0) || !i && (y>0 && py>0)) {
~~~^~~~~~~~~~~~~~~~
cut.cpp:16:17: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if(!i || y<0 && qx!=x) {
~~~~^~~~~~~~
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 |
6 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
256 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
6 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 |
384 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 |
6 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
256 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
6 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 |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
19 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
6 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
256 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
6 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 |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
19 |
Halted |
0 ms |
0 KB |
- |