Submission #145549

#TimeUsernameProblemLanguageResultExecution timeMemory
145549surface03공주님의 정원 (KOI11_flower)C++14
18 / 18
45 ms2080 KiB
#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)

flower.cpp: In function 'int main()':
flower.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
flower.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d%d",&n1,&n2,&n3,&n4);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...