# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
846107 | vjudge1 | Datum (COCI20_datum) | C++11 | 75 ms | 492 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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] ;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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |