This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |