# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
238503 | 2020-06-11T15:09:04 Z | Salito | Datum (COCI20_datum) | C++14 | 1000 ms | 384 KB |
#include<bits/stdc++.h> using namespace std; int month(int y,int m) { if(m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12) return 3; if(m!=2)return 2; if(y%4 == 0) return 1; return 0; } void solve(string s) { int d,m,y1,y2,y; d=(s[0]-'0')*10+s[1]-'0'; m=(s[3]-'0')*10+s[4]-'0'; y1=(s[7]-'0')*10+s[6]-'0'; y2=(s[9]-'0')*10+s[8]-'0'; y=(s[8]-'0')*10+s[9]-'0'; if(m == y1 && d < y2 && y2 <= 28 + month(y,m)) { if(y2<10)cout<<0; cout<<y2<<"."; if(m<10)cout<<0; cout<<m<<"."<<s[6]<<s[7]<<s[8]<<s[9]<<".\n"; return ; } if(y1>12) { y = (s[6]-'0')*10+s[7]-'0'; do { y++; y1 = (y%10) *10 + y/10; }while(y1 >12); cout<<"10."; if(y1<10) cout<<"0"; cout<<y1<<"."; if(y<10)cout<<"0"; cout<<y<<"01.\n"; return ; } y1=(s[6]-'0')*10+s[7]-'0'; y2=(s[8]-'0')*10+s[9]-'0'; m = (y1%10) *10 + y1/10; if(m/10 == s[3]-'0' && m%10 == s[4]-'0')y2++; while(y2<100); { int ry; ry = (y2%10) *10 + y2/10; if(ry <= 28 +month(y2,m)) { if(ry<10) cout<<0; cout<<ry<<"."; if(m<10)cout<<0; cout<<m<<"."; if(y1<10)cout<<0; cout<<y1; if(y2<10)cout<<0; cout<<y2<<".\n"; return ; } y2++; } y = (s[6]-'0')*10+s[7]-'0'; //y++; do { y++; y1 = (y%10) *10 + y/10; }while(y1 >12); cout<<"10."; if(y1<10) cout<<"0"; cout<<y1<<"."; if(y<10)cout<<"0"; cout<<y<<"01.\n"; return ; } int main() { string s; int n,i; cin>>n; for(i=0;i<n;i++) { cin>>s; solve(s); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | Output is correct |
2 | Execution timed out | 1092 ms | 256 KB | Time limit exceeded |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Execution timed out | 1082 ms | 256 KB | Time limit exceeded |
5 | Execution timed out | 1086 ms | 256 KB | Time limit exceeded |
6 | Execution timed out | 1093 ms | 256 KB | Time limit exceeded |
7 | Execution timed out | 1095 ms | 256 KB | Time limit exceeded |
8 | Execution timed out | 1092 ms | 384 KB | Time limit exceeded |
9 | Execution timed out | 1096 ms | 256 KB | Time limit exceeded |
10 | Execution timed out | 1093 ms | 256 KB | Time limit exceeded |