Submission #845648

# Submission time Handle Problem Language Result Execution time Memory
845648 2023-09-06T14:41:10 Z vjudge1 Datum (COCI20_datum) C++11
0 / 50
1000 ms 676 KB
#include <bits/stdc++.h>
#define lg(a) (31 - __builtin_clz((a)))
// #define endl ("\n")
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define vi vector<int>
#define st first
#define nd second
#define all(aa) aa.begin(), aa.end()
#define rall(aa) aa.rbegin(), aa.rend()
#define forn(i, n) for(int i=0;i<n;i++)
#define trav(e, x) for(auto& e:x)
#define until(n, v) (int) (lower_bound(v.begin(), v.end(), n)-v.begin()) //# of elements < n
#define after(n, v) (int) (v.end()-upper_bound(v.begin(), v.end(), n))   //# of elements > n
#define sameas(n, v) (int) (upper_bound(v.begin(), v.end(), n) - lower_bound(v.begin(), v.end(), n)) //# of elements ==n
typedef long long ll;
using namespace std;
/*

*/

vector<string> pal;


void precalc(){
	int m=0, d=0, y=0;
	char s[8];
	while (y < 1){
		d++; 
		if(d>=28){
			if(m==1 or m==3 or m==5 or m==7 or m==8 or m==10 or m==12){
				d = (d-1)%31 + 1;
				m += d/31;
				m = (m-1)%12 +1;
				y +=m/12; 
			}
			if(m==4 or m==6 or m==9 or m==11){
				d = (d-1)%30 + 1;
				m += d/30;
				m = (m-1)%12 +1;
				y +=m/12;
			}
			if(m==2 and y%4!=0){
				d = (d-1)%28 + 1;
				m += d/28;
				m = (m-1)%12 +1;
				y +=m/12;
			}
			else{
				if(m==2 and y%4==0){
				d = (d-1)%29 + 1;
				m += d/29;
				m = (m-1)%12 +1;
				y +=m/12;
				}
			}
		}
		s[0] = d/10;
		s[1] = d%10;
		s[2] = m/10;
		s[3] = m%10;
		s[4] = y/1000;
		s[5] = (y/100)%10;
		s[6] = (y/10) % 10;
		s[7] = y%10;
		if(s[0]==s[7] and s[1] == s[6] and s[2]==s[5] and s[3]==s[4]){
			pal.pb(s);
			cout<<"a"<<endl;
		}
	}
}


void solve(){
	string a; cin>>a;
	int d=(a[0]-'0')*10 + (a[1]-'0'), m = (a[3]-'0')*10 + (a[4]-'0'), y=1000*(a[6]-'0') + 100*(a[7]-'0')+10*(a[8]-'0')+(a[9]-'0');
	int s[8];
	int ispal=0;
	while (!ispal){
		d++; 
		if(d>=28){
			if(m==1 or m==3 or m==5 or m==7 or m==8 or m==10 or m==12){
				d = (d-1)%31 + 1;
				m += d/31;
				m = (m-1)%12 +1;
				y +=m/12; 
			}
			if(m==4 or m==6 or m==9 or m==11){
				d = (d-1)%30 + 1;
				m += d/30;
				m = (m-1)%12 +1;
				y +=m/12;
			}
			if(m==2 and y%4!=0){
				d = (d-1)%28 + 1;
				m += d/28;
				m = (m-1)%12 +1;
				y +=m/12;
			}
			else{
				if(m==2 and y%4==0){
				d = (d-1)%29 + 1;
				m += d/29;
				m = (m-1)%12 +1;
				y +=m/12;
				}
			}
		}
		s[0] = d/10;
		s[1] = d%10;
		s[2] = m/10;
		s[3] = m%10;
		s[4] = y/1000 ;
		s[5] = (y/100)%10 ;
		s[6] = (y/10) % 10 ;
		s[7] = y%10;
		// cout<<s[0]<<s[1]<<'.'<<s[x2]<<s[3]<<'.'<<s[4]<<s[5]<<s[6]<<s[7]<<endl;
		if(s[0]==s[7] and s[1] == s[6] and s[2]==s[5] and s[3]==s[4]){
			ispal=1;
		}
	}
	cout<<s[0]<<s[1]<<'.'<<s[2]<<s[3]<<'.'<<s[4]<<s[5]<<s[6]<<s[7]<<endl;

}

int main(){
	// precalc();
	int test; 
    cin >> test;
   	while (test--){
		solve();
    }
}



# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Execution timed out 1043 ms 592 KB Time limit exceeded
3 Incorrect 0 ms 344 KB Output isn't correct
4 Incorrect 3 ms 344 KB Output isn't correct
5 Incorrect 4 ms 348 KB Output isn't correct
6 Incorrect 5 ms 348 KB Output isn't correct
7 Incorrect 7 ms 344 KB Output isn't correct
8 Incorrect 8 ms 344 KB Output isn't correct
9 Incorrect 7 ms 344 KB Output isn't correct
10 Execution timed out 1058 ms 676 KB Time limit exceeded