Submission #845198

# Submission time Handle Problem Language Result Execution time Memory
845198 2023-09-06T12:32:57 Z vjudge1 Datum (COCI20_datum) C++17
15 / 50
5 ms 348 KB
#include <bits/stdc++.h>
#pragma optimize "DostSeferoğlu"
#pragma GCC optimize("unroll-loops,Ofast")
#pragma GCC target("avx2,tune=native")
using namespace std;
#define int long long
#define pii pair<int,int>
#define bg begin
#define vi vector<int>
#define endl '\n'
#define vvi vector<vi> 
#define pc __builtin_popcountll
#define vp vector<pii>
#define sp << " " << 
#define all(x) x.bg()+1,x.end()
#define ff first
#define ss second
#define brake {cout << "OK\n";return;}
#define debug(x) {cout << #x << ": "; for (auto it : x) cout << it << " ";cout << endl;}
#define FF(xxx,sss,yyy) for (int xxx=sss;xxx<=yyy;++xxx)
#define F(xx,yy) for (int xx=1;xx<=yy;++xx)
#define pb push_back 
const int inf = 1e18;
const int MOD = 998244353;   
const int N = 2e5+1;


void solve() {
    int q;
    cin >> q;
    vector<int> goodyears;
    vi cap(13);
    cap = {0,31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30,31};
    for (int y=0;y<=9999;y++) {
        string s = to_string(y);
        while (s.size() < 4) s = "0"+s;
        string month;
        month+=s[1];
        month+=s[0];
        if (stoi(month) > 12 || !stoi(month)) continue;
        string day;
        day+=s[3];
        day+=s[2];
        if (y%4 == 0) cap[2]++;
        int m = stoi(month);
        int d = stoi(day);
        if (d>cap[m] || !stoi(day)) {
            if (y%4 == 0) cap[2]--;
            continue;
        }
        if (y%4 == 0) cap[2]--;
        goodyears.pb(y);
    }
    while (q--) {
        string s;
        cin >> s;
        string year;
        year+=s[6];
        year+=s[7];
        year+=s[8];
        year+=s[9];
        int y = stoi(year);
        int x = *upper_bound(goodyears.bg(),goodyears.end(),y);
        string ss = to_string(x);
        while (ss.size() < 4) {
            ss = "0"+ss;
        } 
        cout << ss[3] << ss[2] << '.' << ss[1] << ss[0] << '.' << ss <<  '.' << endl;
    }
}    



signed main() { 
    ios_base::sync_with_stdio(0);cin.tie(0);
    #ifdef Local
        freopen("input.in", "r", stdin);
        freopen("input.out", "w", stdout);  
    #endif
    int t = 1;
    //cin >> t;
    while (t --> 0) solve();
}

Compilation message

datum.cpp:2: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    2 | #pragma optimize "DostSeferoğlu"
      |
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Incorrect 5 ms 348 KB Output isn't correct
3 Incorrect 1 ms 344 KB Output isn't correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Incorrect 1 ms 348 KB Output isn't correct
6 Correct 1 ms 348 KB Output is correct
7 Incorrect 1 ms 348 KB Output isn't correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Incorrect 4 ms 348 KB Output isn't correct