#include<stdio.h>
#define _ 366
int T[_][_];
int D[]={0,0,31,59,90,120,151,181,212,243,273,304,334};
int main(){
int N,i,j,k;
for(scanf("%d",&N);N--;){
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
int st=D[a]+b, en=D[c]+d;
for(i=st;i<en;i++){
for(j=i;j<en;j++)T[i][j]=1;
}
}
for(int x=2;x<366;x++){
for(i=1,j=x;j<366;i++,j++){
if(T[i][j])continue;
T[i][j]=2147483647;
for(k=i;k<j;k++){
if(!T[i][k]||!T[k+1][j])continue;
int tmp=T[i][k]+T[k+1][j];
if(tmp<T[i][j])T[i][j]=tmp;
}
if(T[i][j]==2147483647)T[i][j]=0;
}
}
printf("%d",T[D[3]+1][D[11]+30]);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
1408 KB |
Output is correct |
2 |
Correct |
11 ms |
1408 KB |
Output is correct |
3 |
Correct |
15 ms |
1408 KB |
Output is correct |
4 |
Correct |
16 ms |
1408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
1408 KB |
Output is correct |
2 |
Correct |
16 ms |
1408 KB |
Output is correct |
3 |
Correct |
15 ms |
1408 KB |
Output is correct |
4 |
Correct |
15 ms |
1408 KB |
Output is correct |
5 |
Correct |
16 ms |
1408 KB |
Output is correct |
6 |
Correct |
24 ms |
1408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
1408 KB |
Output is correct |
2 |
Correct |
22 ms |
1408 KB |
Output is correct |
3 |
Correct |
29 ms |
1408 KB |
Output is correct |
4 |
Correct |
29 ms |
1408 KB |
Output is correct |
5 |
Correct |
43 ms |
1408 KB |
Output is correct |
6 |
Correct |
40 ms |
1408 KB |
Output is correct |
7 |
Correct |
49 ms |
1408 KB |
Output is correct |
8 |
Correct |
145 ms |
1408 KB |
Output is correct |
9 |
Correct |
51 ms |
1408 KB |
Output is correct |
10 |
Correct |
55 ms |
1408 KB |
Output is correct |