# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
845311 |
2023-09-06T13:07:37 Z |
vjudge1 |
Datum (COCI20_datum) |
C++17 |
|
22 ms |
516 KB |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back
#define fi first
#define se second
#define CDIV(a,b) (((a)+(b)-(1))/(b))
ll mod_(ll a, ll b)
{
if(a >= 0)return a % b;
a += (-a/b + 1) * b;
return a % b;
}
ll to_int(string s) // TEST THIS
{
ll d = stoi(string{s.begin(), s.begin() + 2}),
m = stoi(string{s.begin() + 3, s.begin() + 5}),
y = stoi(string{s.begin() + 6, s.end() - 1});
return (1e4 * y) + (100 * m) + d;
}
string int_to_str(ll x)
{
string d = to_string(x % 100),
m = to_string((x % 10000) / 100),
y = to_string(x / 10000);
while(d.size() < 2)d = "0" + d;
while(m.size() < 2)m = "0" + m;
while(y.size() < 4)y = "0" + y;
return d + "." + m + "." + y + ".";
}
ll mon[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30 ,31};
bool check(string day, string mo, string ye)
{
ll d = stoi(day), m = stoi(mo), y = stoi(ye);
if(d < 1 or m < 1)return false;
if(m == 2 and d == 29 and y % 4)return false;
if(m > 12)return false;
if(mon[m - 1] < d)return false;
return true;
}
set<ll>s;
void solve()
{
for(ll i = 0; i < 3000; ++i)
{
string y = to_string(i);
while(y.size() < 4)y = "0" + y;
reverse(y.begin(), y.end());
string d{y.begin(), y.begin() + 2},
m{y.begin() + 2, y.end()};
reverse(y.begin(), y.end());
if(check(d, m, y))
{
s.insert(to_int(d + "." + m + "." + y + "."));
}
}
ll n;
cin >> n;
while(n--)
{
string a;
cin >> a;
ll ans = *s.upper_bound(to_int(a));
cout << int_to_str(ans) << endl;
}
}
int main()
{
//fio;
//ll t; cin >> t; while(t--)
{
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Incorrect |
22 ms |
344 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
10 |
Incorrect |
18 ms |
516 KB |
Output isn't correct |