# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
145549 | surface03 | 공주님의 정원 (KOI11_flower) | C++14 | 45 ms | 2080 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |