#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
1612 KB |
Output is correct |
2 |
Correct |
12 ms |
1612 KB |
Output is correct |
3 |
Correct |
16 ms |
1612 KB |
Output is correct |
4 |
Correct |
16 ms |
1612 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
1612 KB |
Output is correct |
2 |
Correct |
16 ms |
1612 KB |
Output is correct |
3 |
Correct |
16 ms |
1612 KB |
Output is correct |
4 |
Correct |
16 ms |
1612 KB |
Output is correct |
5 |
Correct |
20 ms |
1612 KB |
Output is correct |
6 |
Correct |
20 ms |
1612 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
1612 KB |
Output is correct |
2 |
Correct |
24 ms |
1612 KB |
Output is correct |
3 |
Correct |
28 ms |
1612 KB |
Output is correct |
4 |
Correct |
32 ms |
1612 KB |
Output is correct |
5 |
Correct |
44 ms |
1612 KB |
Output is correct |
6 |
Correct |
32 ms |
1612 KB |
Output is correct |
7 |
Correct |
44 ms |
1612 KB |
Output is correct |
8 |
Correct |
144 ms |
1612 KB |
Output is correct |
9 |
Correct |
52 ms |
1612 KB |
Output is correct |
10 |
Correct |
52 ms |
1612 KB |
Output is correct |