# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
227431 |
2020-04-27T12:21:23 Z |
cgiosy |
None (KOI17_cut) |
C++17 |
|
4 ms |
384 KB |
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
constexpr int INF=0x3f3f3f3f;
int main() {
ios::sync_with_stdio(0);cin.tie(0);
int N, sx, sy, px, py, qx=INF;
cin>>N>>sx>>sy; px=sx, py=sy;
vector<int> A;
A.reserve(N/4+2);
auto push=[&](int &s, int &e) {
A.push_back(min(s, e)*2);
A.push_back(max(s, e)*2+1);
s=e=INF;
};
for(int i=1; i<N; i++) {
int x, y;
cin>>x>>y;
if((y>0)!=(py>0)) {
if(qx!=INF) push(qx, x);
qx=x;
}
px=x, py=y;
}
if(qx!=INF) push(qx, sx);
sort(begin(A), end(A));
int a=0, b=0, c=0, p=0;
for(int x:A) {
if(x%2) b+=!p, p=1;
else a+=!c++, p=0;
}
cout<<a<<' '<<b;
}
Compilation message
cut.cpp: In function 'int main()':
cut.cpp:8:17: warning: variable 'px' set but not used [-Wunused-but-set-variable]
int N, sx, sy, px, py, qx=INF;
^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |