Submission #16326

# Submission time Handle Problem Language Result Execution time Memory
16326 2015-08-21T10:36:33 Z comet 공주님의 정원 (KOI11_flower) C++
18 / 18
57 ms 3392 KB
#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
1 Correct 0 ms 2496 KB Output is correct
2 Correct 0 ms 2496 KB Output is correct
3 Correct 0 ms 2496 KB Output is correct
4 Correct 0 ms 2496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2496 KB Output is correct
2 Correct 0 ms 2496 KB Output is correct
3 Correct 0 ms 2496 KB Output is correct
4 Correct 0 ms 2496 KB Output is correct
5 Correct 0 ms 2632 KB Output is correct
6 Correct 3 ms 2632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 2632 KB Output is correct
2 Correct 9 ms 2764 KB Output is correct
3 Correct 20 ms 2764 KB Output is correct
4 Correct 22 ms 3008 KB Output is correct
5 Correct 19 ms 3008 KB Output is correct
6 Correct 29 ms 3008 KB Output is correct
7 Correct 41 ms 3392 KB Output is correct
8 Correct 52 ms 3392 KB Output is correct
9 Correct 47 ms 3392 KB Output is correct
10 Correct 57 ms 3392 KB Output is correct