Submission #845425

#TimeUsernameProblemLanguageResultExecution timeMemory
845425vjudge1Datum (COCI20_datum)C++17
40 / 50
8 ms856 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int N = 2e5 + 5, MOD = 1e9 + 7; int arr[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; vector<ll> vec; map<ll, array<ll, 2>> mp; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); for(int i = 0; i <= 9999; i++) { string a; if(i < 10) { a = "000" + to_string(i); } else if(i < 100) { a = "00" + to_string(i); } else if(i < 1000) { a = "0" + to_string(i); } else { a = to_string(i); } string day; day.push_back(a[3]); day.push_back(a[2]); string month; month.push_back(a[1]); month.push_back(a[0]); ll d = stoi(day), m = stoi(month); if(m <= 12 and m >= 1 and d >= 1 and d <= arr[m]) { vec.push_back(stoi(a)); mp[i] = {d, m}; } } int t; cin >> t; while(t--) { string str; cin >> str; string day; day.push_back(str[0]); day.push_back(str[1]); string month; month.push_back(str[3]); month.push_back(str[4]); string year; year.push_back(str[6]); year.push_back(str[7]); year.push_back(str[8]); year.push_back(str[9]); string asd = "123"; ll d = stoi(day); ll m = stoi(month); ll y = stoi(year); int ind = lower_bound(vec.begin(), vec.end(), y) - vec.begin(); if(y == vec[ind] and (m > mp[vec[ind]][1] or (m == mp[vec[ind]][1] and d >= mp[vec[ind]][0]))) ind++; string x, z; if(mp[vec[ind]][0] < 10) { x = "0" + to_string(mp[vec[ind]][0]); } else { x = to_string(mp[vec[ind]][0]); } if(mp[vec[ind]][1] < 10) { z = "0" + to_string(mp[vec[ind]][1]); } else { z = to_string(mp[vec[ind]][1]); } string asdasdas; if(vec[ind] < 10) { asdasdas = "000" + to_string(vec[ind]); } else if(vec[ind] < 100) { asdasdas = "00" + to_string(vec[ind]); } else if(vec[ind] < 1000) { asdasdas = "0" + to_string(vec[ind]); } else { asdasdas = to_string(vec[ind]); } cout << x << "." << z << "." << asdasdas << "." << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...