# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
145549 | 2019-08-20T11:30:14 Z | surface03 | 공주님의 정원 (KOI11_flower) | C++14 | 45 ms | 2080 KB |
#include<bits/stdc++.h> using namespace std; int ans,np,flag,n; struct data{ int fr,re; bool operator<(const data&r)const{ return fr<r.fr; } }p[100010]; int main(){ scanf("%d",&n); for(int i=0,n1,n2,n3,n4;i<n;i++){ scanf("%d%d%d%d",&n1,&n2,&n3,&n4); p[i].fr=40*n1+n2; p[i].re=40*n3+n4; } sort(p,p+n); flag=40*3+1; np=-1; for(int i=0;i<n;i++){ if(flag>=40*12+1)break; if(p[i].fr>flag){ if(np==-1){ printf("0"); return 0; } flag=p[np].re; np=-1; ans++; } if(p[i].fr<=flag&&p[i].re>=40*12+1){ flag=1<<30; ans++; break; } if(i==n-1){ if(p[i].fr<=flag&&p[i].re>=40*12+1){ flag=1<<30; ans++; break; } } if(np==-1){ np=i; continue; } if(p[np].re<p[i].re){ np=i; } } if(flag<40*12+1){ printf("0"); } else printf("%d",ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 4 ms | 376 KB | Output is correct |
6 | Correct | 6 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 632 KB | Output is correct |
2 | Correct | 10 ms | 632 KB | Output is correct |
3 | Correct | 13 ms | 888 KB | Output is correct |
4 | Correct | 17 ms | 1016 KB | Output is correct |
5 | Correct | 22 ms | 1144 KB | Output is correct |
6 | Correct | 25 ms | 1400 KB | Output is correct |
7 | Correct | 30 ms | 1564 KB | Output is correct |
8 | Correct | 42 ms | 2040 KB | Output is correct |
9 | Correct | 38 ms | 2080 KB | Output is correct |
10 | Correct | 45 ms | 2012 KB | Output is correct |