# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
845664 |
2023-09-06T14:48:52 Z |
vjudge1 |
Datum (COCI20_datum) |
C++17 |
|
1000 ms |
171380 KB |
#include <bits/stdc++.h>
using namespace std;
map < string , string > mpa;
bool is_palindrome(string &s){
int sz = (int)s.size();
for(int i = 0;i<(sz/2);i++){
if(s[i] != s[sz-i-1])return 0;
}
return 1;
}
void solve(){
string str;cin >> str;
string temp;
for(auto itr : str)if(itr != '.')temp += itr;
str = temp;
//cout << str << endl;
int monthend[13] = {0 , 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30,31};
//int sayac = 0;
do {
int day = (str[0] - '0') * 10 + (str[1] - '0');
int month = (str[2] - '0') * 10 + (str[3] - '0');
int year = (str[4] - '0') * 1000 + (str[5] - '0') * 100 + (str[6] - '0') * 10 + (str[7] - '0');
//if(sayac++ < 30)cout << day << "." << month << "." << year << endl;
if(year % 4 == 0)monthend[2]++;
day++;
if((monthend[month]+1) == day){
day = 1;
month++;
}
if(month == 13){
month = 1;
year++;
}
if(monthend[2] == 29)monthend[2]--;
str = "";
if(day / 10 == 0)str += '0';
str += to_string(day);
if(month / 10 == 0)str += '0';
str += to_string(month);
if(year / 1000 == 0)str += '0';
if(year / 100 == 0)str += '0';
if(year / 10 == 0)str += '0';
str += to_string(year);
if(mpa.count(str)){
str = mpa[str];
break;
}
//if(sayac++ < 30)cout << str << endl;
} while(is_palindrome(str) == 0);
do {
int day = (temp[0] - '0') * 10 + (temp[1] - '0');
int month = (temp[2] - '0') * 10 + (temp[3] - '0');
int year = (temp[4] - '0') * 1000 + (temp[5] - '0') * 100 + (temp[6] - '0') * 10 + (temp[7] - '0');
//if(sayac++ < 30)cout << day << "." << month << "." << year << endl;
if(year % 4 == 0)monthend[2]++;
day++;
if((monthend[month]+1) == day){
day = 1;
month++;
}
if(month == 13){
month = 1;
year++;
}
if(monthend[2] == 29)monthend[2]--;
temp = "";
if(day / 10 == 0)temp += '0';
temp += to_string(day);
if(month / 10 == 0)temp += '0';
temp += to_string(month);
if(year / 1000 == 0)temp += '0';
if(year / 100 == 0)temp += '0';
if(year / 10 == 0)temp += '0';
temp += to_string(year);
mpa[temp] = str;
//if(sayac++ < 30)cout << str << endl;
} while(temp != str);
cout << str[0] << str[1] << "." << str[2] << str[3] << "." << str[4] << str[5] << str[6] << str[7] << "." << endl;
}
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);
int testcase = 1;cin >> testcase;
while(testcase--)solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Execution timed out |
1104 ms |
148692 KB |
Time limit exceeded |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
646 ms |
91224 KB |
Output is correct |
7 |
Correct |
722 ms |
92240 KB |
Output is correct |
8 |
Correct |
915 ms |
126492 KB |
Output is correct |
9 |
Correct |
889 ms |
116312 KB |
Output is correct |
10 |
Execution timed out |
1066 ms |
171380 KB |
Time limit exceeded |