# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
846020 | vjudge1 | Datum (COCI20_datum) | C++17 | 83 ms | 664 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define OPEN freopen(".in", "r", stdin); \
freopen(".out", "w", stdout);
#else
#define OPEN void(23);
#endif
set <int> vec;
int months[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int toint(string &a)
{
int val = 0;
for(char &ch : a) val = val * 10 + (ch - '0');
return val;
}
void precalc()
{
for(int i = 1; i <= 12; i++)
{
for(int j = 1; j <= months[i]; j++)
{
string str = (i <= 9 ? "0" : "") + to_string(i)
+ (j <= 9 ? "0" : "") + to_string(j);
reverse(str.begin(), str.end());
int year = toint(str);
vec.emplace(year * 10000 + j * 100 + i);
}
}
}
void solve()
{
string date; cin >> date;
int day = 0, month = 0, year = 0;
for(int i = 1; i <= 2; i++) day = day * 10 + date[0 + i -1] - '0';
for(int i = 1; i <= 2; i++) month = month * 10 + date[3 + i -1] - '0';
for(int i = 1; i <= 4; i++) year = year * 10 + date[6 + i -1] - '0';
auto it = vec.upper_bound(year * 10000 + month * 100 + day);
int _year = *it / 10000;
int _month = (*it / 100) % 100;
int _day = *it % 100;
cerr << day << '.' << month << '.' << year << ".\n";
if(_day <= 9) cout << '0';
cout << _day << '.';
if(_month <= 9) cout << '0';
cout << _month << '.';
if(_year <= 9) cout << '0';
if(_year <= 99) cout << '0';
if(_year <= 999) cout << '0';
cout << _year << '.';
return;
}
int32_t main()
{
OPEN;
precalc();
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int t = 1; cin >> t;
while(t--)
{
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |