Submission #845551

# Submission time Handle Problem Language Result Execution time Memory
845551 2023-09-06T14:05:43 Z vjudge1 Datum (COCI20_datum) C++17
40 / 50
23 ms 500 KB
#pragma GCC optimize("unroll-loops,Ofast,O3")
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define spc << " " <<
#define all(x) x.begin(), x.end()
#define ll long long
#define int long long
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define st first
#define nd second
#define inf 1000000009
#define MOD 1000000007

using namespace std;





void solve(){
    string s; cin >> s;
    int yea=(s[6]-'0')*1000 + (s[7]-'0')*100 + (s[8]-'0')*10 + (s[9]-'0');
    int mon=(s[3]-'0')*10 + (s[4]-'0');
    int day=(s[0]-'0')*10 + (s[1]-'0');
    for(int n=yea; n<=9999; n++){
        int d1=n/1000, d2=(n%1000)/100, d3=(n%100)/10, d4=n%10;
        int nmon=(d2*10)+d1;
        if(nmon>12 || nmon==0 || (n==yea && nmon<mon)) continue;
        int nday=(d4*10)+d3;
        if(nday>31 || nday==0 || (n==yea && nmon==mon && nday<=day)) continue;
        if((nmon==4 || nmon==6 || nmon==9 || nmon==11) && nday>30) continue;
        if(n%4==0){
            if(nmon==2 && nday>28) continue;
        }
        else{
            if(nmon==2 && nday>29) continue;
        }
        cout << d4 << d3 << "." << d2 << d1 << "." << d1 << d2 << d3 << d4 << "." << endl;
        return;
    }
}



signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    #ifdef Local
    freopen("in.txt","r",stdin);
    freopen("out","w",stdout);
    #endif
    

    ll t=1;
    cin >> t;
    while(t--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 22 ms 500 KB Output isn't correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Incorrect 0 ms 344 KB Output isn't correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 23 ms 344 KB Output is correct