Submission #16326

#TimeUsernameProblemLanguageResultExecution timeMemory
16326comet공주님의 정원 (KOI11_flower)C++98
18 / 18
57 ms3392 KiB
#include<iostream> #include<algorithm> #include<queue> using namespace std; typedef pair<int,int> pp; int n; int D[13]={0,31,28,31,30,31,30,31,31,30,31,30,31},sum[13]; pp a[100000]; int t(int x,int y){ return sum[x-1]+y; } int main(){ ios::sync_with_stdio(0); for(int i=1;i<13;i++)sum[i]=sum[i-1]+D[i]; cin>>n; int x,y; for(int i=0;i<n;i++){ cin>>x>>y; a[i].first=t(x,y); cin>>x>>y; a[i].second=t(x,y); } sort(a,a+n); priority_queue<int> Q; int p=t(3,1),ans=0; for(int i=0;i<n;){ while(i<n&&a[i].first<=p)Q.push(a[i++].second); p=Q.top(); Q.pop(); ans++; if(p>t(11,30))break; } if(p>t(11,30))cout<<ans; else cout<<0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...