Submission #845230

# Submission time Handle Problem Language Result Execution time Memory
845230 2023-09-06T12:42:15 Z vjudge1 Datum (COCI20_datum) C++14
20 / 50
24 ms 556 KB
// Aber der schlimmste Fiend, dem du begegnen kannst, wirst du immer dir selber sein
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma,tune=native")
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ff first
#define ss second
#define pb push_back
#define rev reverse
#define all(x) x.begin(),x.end()
#define acc accumulate
#define sz size()
#define MOD 1000000007
#define rall(x) x.rbegin(),x.rend()
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const int N = 2e5 + 5;
int arr[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int check(int d, int m, int y){
    m--;
    if(d < 1) return 0;
    if(d <= arr[m]) return 1;
    if(d == 29 && m == 1 && y % 4 == 0) return 1;
    return 0;
}
inline void solve(){
    string s;
    cin >> s;
    int year, month, day;
    year = (s[6] - '0') * 1000 + (s[7] - '0') * 100 + (s[8] - '0') * 10 + (s[9] - '0');
    int year_in_arr[4];
    day = (s[0] - '0') * 10 + (s[1] - '0'), month = (s[3] - '0') * 10 + (s[4] - '0');
    year_in_arr[0] = year / 1000;
    year %= 1000;
    year_in_arr[1] = year / 100;
    year %= 100;
    year_in_arr[2] = year / 10;
    year %= 10;
    year_in_arr[3] = year;
    year = year_in_arr[0] * 1000 + year_in_arr[1] * 100 + year_in_arr[2] * 10 + year_in_arr[3];
    while(1){
        int d = year_in_arr[3] * 10 + year_in_arr[2];
        int m = year_in_arr[1] * 10 + year_in_arr[0];
        int y = year_in_arr[0] * 1000 + year_in_arr[1] * 100 + year_in_arr[2] * 10 + year_in_arr[3];
        if(y < year){

        }
        else if(y == year && m < month){

        }
        else if(y == year && m == month && d <= day){

        }
        else if(check(d, m, y)){
            cout << year_in_arr[3] << year_in_arr[2] << "." << year_in_arr[1] << year_in_arr[0] << ".";
            for(int i = 0; i < 4; i++) cout << year_in_arr[i];
            cout << "." << endl;
            break;
        }
        if(++year_in_arr[3] == 10) year_in_arr[3] = 0, year_in_arr[2]++;
        if(year_in_arr[2] == 10) year_in_arr[2] = 0, year_in_arr[1]++;
        if(year_in_arr[1] == 10) year_in_arr[1] = 0, year_in_arr[0]++; 
    }
}
int main(){
    fast_io
    int t;
    cin >> t;
    while(t--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 24 ms 344 KB Output isn't correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Incorrect 0 ms 344 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 344 KB Output isn't correct
10 Incorrect 24 ms 556 KB Output isn't correct