Submission #845060

# Submission time Handle Problem Language Result Execution time Memory
845060 2023-09-06T11:45:30 Z vjudge1 Datum (COCI20_datum) C++17
0 / 50
37 ms 604 KB
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int int64_t
#define ordered_set                              \
    tree<int, null_type, less<int>, rb_tree_tag, \
         tree_order_statistics_node_update>
#define F first
#define S second
#define I insert
#define PB push_back
#define POB pop_back
#define sqr(a) ((a) * (a))
#define P pop
#define max3(a, b, c) (max(a, max(b, c)))
#define max4(a, b, c, d) (max(max(a, b), max(c, d)))
#define min3(a, b, c) (min(a, min(b, c)))
#define min4(a, b, c, d) (min(min(a, b), min(c, d)))
#define MOD 1000000007
#define mod 998244353
int binpow(int a, int p, int m = MOD) {
    int ans = 1;
    while (p) {
        if (p & 1) ans = ((ans % m) * (a % m)) % m;
        a = sqr(a) % m;
        p >>= 1;
    }
    return ans;
}
map<int, int> mont;
int d, m;
bool isvalid(int y) {
    d = y % 100;
    d = (d % 10) * 10 + d / 10;
    m = y / 100;
    m = (m % 10) * 10 + m / 10;
    if (m > 12) return false;
    if ((m == 2 && y % 4 == 0 && d <= 29) || d <= mont[m]) {
        return true;
    }
    return false;
}
void solve() {
    string s;
    cin >> s;
    int y = stoi(string({s[6], s[7], s[8], s[9]}));
    for (int i = y + 1; i <= 9999; i++) {
        if (isvalid(i)) {
            string D = to_string(d);
            if (D.size() == 1) D = "0" + D;
            string M = to_string(m);
            if (M.size() == 1) M = "0" + M;
            string I = to_string(i);
            if (I.size() != 4) I = string(4 - I.size(), '0') + I;
            cout << D << '.' << M << '.' << I << '.' << endl;
            return;
        }
    }
}
int32_t main() {
    int t = 1;
    cin >> t;
    mont[1] = 31;
    mont[2] = 28;
    mont[3] = 31;
    mont[4] = 30;
    mont[5] = 31;
    mont[6] = 30;
    mont[7] = 31;
    mont[8] = 31;
    mont[9] = 30;
    mont[10] = 31;
    mont[11] = 30;
    mont[12] = 31;

    while (t--) {
        solve();
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Incorrect 35 ms 604 KB Output isn't correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Incorrect 0 ms 348 KB Output isn't correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Incorrect 37 ms 544 KB Output isn't correct