#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 |
1 |
Correct |
0 ms |
884 KB |
Output is correct |
2 |
Correct |
0 ms |
884 KB |
Output is correct |
3 |
Correct |
0 ms |
884 KB |
Output is correct |
4 |
Correct |
0 ms |
884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
884 KB |
Output is correct |
2 |
Correct |
0 ms |
884 KB |
Output is correct |
3 |
Correct |
0 ms |
884 KB |
Output is correct |
4 |
Correct |
0 ms |
884 KB |
Output is correct |
5 |
Correct |
5 ms |
888 KB |
Output is correct |
6 |
Correct |
10 ms |
964 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
1052 KB |
Output is correct |
2 |
Correct |
17 ms |
1124 KB |
Output is correct |
3 |
Correct |
29 ms |
1280 KB |
Output is correct |
4 |
Correct |
39 ms |
1440 KB |
Output is correct |
5 |
Correct |
51 ms |
1592 KB |
Output is correct |
6 |
Correct |
63 ms |
1752 KB |
Output is correct |
7 |
Correct |
70 ms |
1908 KB |
Output is correct |
8 |
Correct |
105 ms |
2372 KB |
Output is correct |
9 |
Correct |
97 ms |
2380 KB |
Output is correct |
10 |
Correct |
100 ms |
2376 KB |
Output is correct |