Submission #846113

#TimeUsernameProblemLanguageResultExecution timeMemory
846113vjudge1Datum (COCI20_datum)C++11
50 / 50
77 ms580 KiB
#include <bits/stdc++.h> #define lg(a) (31 - __builtin_clz((a))) // #define endl ("\n") #define pb push_back #define mp make_pair #define lb lower_bound #define ub upper_bound #define vi vector<int> #define st first #define nd second #define all(aa) aa.begin(), aa.end() #define rall(aa) aa.rbegin(), aa.rend() #define forn(i, n) for(int i=0;i<n;i++) #define trav(e, x) for(auto& e:x) #define until(n, v) (int) (lower_bound(v.begin(), v.end(), n)-v.begin()) //# of elements < n #define after(n, v) (int) (v.end()-upper_bound(v.begin(), v.end(), n)) //# of elements > n #define sameas(n, v) (int) (upper_bound(v.begin(), v.end(), n) - lower_bound(v.begin(), v.end(), n)) //# of elements ==n typedef long long ll; using namespace std; /* */ vector<int> mm{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; void solve(){ string s; cin >> s; for(auto &e : s) e-='0'; int d = 10*s[0] + s[1], m = 10*s[3] + s[4] , y = 1000*s[6] + 100*s[7] + 10*s[8] + s[9]; vector<tuple<int, int, int>> pal; pal.pb({2092, 02, 29}); for(int mon=1; mon <= 12; mon++){ for(int day = 1; day <= mm[mon-1] ;day++){ int year = 1000*(mon%10) + 100*(mon/10) + 10 * (day%10) + (day/10); pal.pb({year, mon, day}); } } // cout<<pal.size()<<endl; sort(all(pal)); tuple<int, int, int> given = {y, m, d}; for(auto date: pal){ if(date > given){ int day = get<2>(date), mon = get<1>(date), year = get<0>(date); cout<<day/10<<day%10<<'.'<<mon/10<<mon%10<<'.'<<(year/1000)<<(year/100)%10<<year/10%10<<year%10<<'.'<<endl; break; } } } int main(){ int test; cin >> test; while (test--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...