# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
846014 | vjudge1 | Datum (COCI20_datum) | C++17 | 18 ms | 628 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.
#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
bool check(int a, int b, int c, string &str)
{
bool ok = true;
if(b <= 0 || 13 <= b) ok = false;
else if(b == 2) ok &= (1 <= a && a <= 28 + (c % 4 == 0));
else if(b <= 7) ok &= (1 <= a && a <= 30 + (b & 1));
else ok &= (1 <= a && 30 + !(b & 1));
if(!ok) return false;
int val = 0;
for(int i = 6; i <= 9; i++) val = val * 10 + str[i] - '0';
if(val == c)
{
val = 0;
for(int i = 3; i <= 4; i++) val = val * 10 + str[i] - '0';
if(val > b) return false;
else if(val == b)
{
val = 0;
for(int i = 0; i <= 1; i++) val = val * 10 + str[i] - '0';
if(val < a) return true;
return false;
}
else return true;
}
if(b == 2) return a <= 28 + (c % 4 == 0);
if(b <= 6) return a <= 30 + (b & 1);
return a <= 30 + !(b & 1);
}
void solve()
{
string str; cin >> str;
int val = 0;
for(int i = 6; i <= 9; i++) val = val * 10 + str[i] - '0';
for(int k = val; k <= 9999; k++)
{
int first = 0;
int _k = k;
for(int i = 9; i >= 8; i--) first = first * 10 + _k % 10, _k /= 10;
int second = 0;
for(int i = 7; i >= 6; i--) second = second * 10 + _k % 10, _k /= 10;
if(check(first, second, k, str))
{
if(first < 10) cout << 0;
cout << first << '.';
if(second < 10) cout << 0;
cout << second << '.';
if(k < 0) cout << 0;
if(k < 10) cout << 0;
if(k < 100) cout << 0;
if(k < 1000) cout << 0;
cout << k << '.';
cout << "\n";
return;
}
}
return;
}
int32_t main()
{
OPEN;
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... |