# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
106994 | 2019-04-21T12:25:57 Z | ttjaerom | None (KOI17_cut) | C++14 | 3 ms | 384 KB |
#include<stdio.h> #include<queue> #include<algorithm> #include<stack> using namespace std; int n; int m; priority_queue<pair<int,int> > q; stack<int> s; int temp; int t=1; int t2=0; int ans1=1; int ans2; int buho(int a) { if(a<0) return 1; //음수면 리턴1 return 0; //양수면 리턴0 } int main() { scanf(" %d",&n); int i; int a,b; for(i=1;i<=n;i++) { scanf(" %d %d",&a,&b); if(i==1) { if(buho(b)==1) temp=-1; else temp=1; } if(buho(temp)!=buho(b)) //전좌표 현좌표 y좌표 부호가 다르면 { q.push(make_pair(a,t)); t2++; if(t2%2==0) t++; } temp=b; } s.push(q.top().second); q.pop(); for(i=2;i<=t;i++) { m=q.top().second; if(s.top()==q.top().second) { s.pop(); q.pop(); } else { if(s.empty()) ans1++; s.push(q.top().second); q.pop(); } if(q.top().second==m) ans2++; } printf("%d %d",ans1,ans2); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Incorrect | 2 ms | 384 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Incorrect | 2 ms | 384 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Incorrect | 2 ms | 384 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |