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<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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |