# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
845082 |
2023-09-06T11:53:10 Z |
vjudge1 |
Datum (COCI20_datum) |
C++17 |
|
17 ms |
532 KB |
#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 <= 6) 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 |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
17 ms |
344 KB |
Output isn't correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
10 |
Incorrect |
17 ms |
532 KB |
Output isn't correct |