Submission #930

#TimeUsernameProblemLanguageResultExecution timeMemory
930tncks0121공주님의 정원 (KOI11_flower)C++98
18 / 18
144 ms1612 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...