| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 845112 | vjudge1 | Datum (COCI20_datum) | C++17 | 3 ms | 600 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#ifndef Local
    #pragma GCC optimize("O3,unroll-loops")
    #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#endif
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define int long long
#define pb push_back
#define lim 300000
#define till 40001
// # of primes till 1e6 = 7e4
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
using pii = array<int,2>;
const int mod=1000000007ll;
set<string>valid;
int monthd[12]{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
bool valider(string s){
    int month=(s[1]-'0')*10+(s[0]-'0');
    if(12<month)return 0;
    int day=(s[3]-'0')*10+(s[2]-'0');
    if(!day)return 0;
    if(day<=monthd[month-1]||(month==2&&day==29)){
        return 1;
    }
    return 0;
}
void solve(){
    string s;
    cin>>s;
    string date=s.substr(6,4);
    auto ite=valid.lower_bound(date);
    if(*ite!=date){
        cout<<(*ite)[3]<<(*ite)[2]<<"."<<(*ite)[1]<<(*ite)[0]<<"."<<*ite<<".\n";
    }else{
        if(!((*ite)[1]>s[3]||(*ite)[0]>s[4]||(*ite)[3]>s[0]||(*ite)[2]>s[1]))ite++;
        cout<<(*ite)[3]<<(*ite)[2]<<"."<<(*ite)[1]<<(*ite)[0]<<"."<<*ite<<".\n";
    }
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
#ifdef Local  
#ifndef INTERACTIVE
    freopen("in","r",stdin);
#endif
    freopen("out","w",stdout);
#endif
    int t=1;
    cin>>t;
    string s="0000";
    for(;s[0]<='9';s[0]++){
        s[1]='0';
        for(;s[1]<='9';s[1]++){
            s[2]='0';
            for(;s[2]<='9';s[2]++){
                s[3]='0';
                for(;s[3]<='9';s[3]++){
                    if(valider(s)){
                        valid.insert(s);
                    }//cerr<<s<<"\n";
                }
            }
        }
    }
    while (t--)
    {
        solve();
    }
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
