| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 845143 | vjudge1 | Datum (COCI20_datum) | C++17 | 1 ms | 348 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 pb push_back
#define int int64_t
using namespace std;
int mp[13] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
constexpr static int M = 100;
constexpr static int Y = 10000;
bool is_palindrome(const char* s)
{
	for (int i = 0; i < 4; i++)
		if (s[i] != s[7-i])
			return false;
	return true;
}
int32_t main()
{
	vector<int> v;
	for (int y = 1; y <= 9999; y++)
	{
		for (int m = 1; m <= 12; m++)
		{
			int td = mp[m];
			if (m == 2 && ((y%4) == 0))
				td = 29;
			for (int d = 1; d <= td; d++)
			{
				char ss[8];
				sprintf(ss, "%02d%02d%04d", d, m, y);
				if (is_palindrome(ss))
					v.pb(d + m * M + y * Y);
			}
		}
	}
	int q;
	cin >> q;
	while (q--)
	{
		string s;
		cin >> s;
		int d = (s[0]-'0') * 10 + (s[1]-'0'), m = (s[3]-'0') * 10 + (s[4]-'0'), y = (s[6]-'0') * 1000 + (s[7]-'0') * 100 + (s[8]-'0') * 10 + (s[9]-'0');
		int res = *upper_bound(v.begin(), v.end(), y * Y + m * M + d);
		cout << res << "\n";
		printf("%02d.%02d.%04d.\n", res % M, (res % Y) / M, res / Y);
	}
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
