Submission #1895

#TimeUsernameProblemLanguageResultExecution timeMemory
1895alephnull공주님의 정원 (KOI11_flower)C++98
18 / 18
105 ms2380 KiB
#include <cstdio> #include <utility> using namespace std; int main() { int m[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int n; scanf("%d", &n); pair<int, int> p[13][32]; for(int i=1;i<=12;i++) for(int j=1;j<=31;j++) p[i][j]=make_pair(1,1); int a[n], b[n], c[n], d[n]; for (int i = 0; i < n; i++) scanf("%d %d %d %d", a + i, b + i, c + i, d + i); for(int i=0;i<n;i++){ for(int j=1;j<=12;j++){ for(int k=1;k<=m[j];k++){ if(j<a[i])break; if(j==a[i]&&k<b[i])continue; pair<int, int> tmp=make_pair(c[i],d[i]); if(p[j][k]<tmp)p[j][k]=tmp; } } } int ans=0; int x=3,y=1; //printf("%d %d\n",x,y); while(make_pair(x,y)<make_pair(11,31)){ if(ans>365){ans=0;break;} ans++; int tmpx=p[x][y].first; int tmpy=p[x][y].second; x=tmpx,y=tmpy; //printf("%d %d\n",x,y); } printf("%d",ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...