# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
845107 |
2023-09-06T11:59:04 Z |
vjudge1 |
Datum (COCI20_datum) |
C++14 |
|
23 ms |
472 KB |
// Aber der schlimmste Fiend, dem du begegnen kannst, wirst du immer dir selber sein
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma,tune=native")
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ff first
#define ss second
#define pb push_back
#define rev reverse
#define all(x) x.begin(),x.end()
#define acc accumulate
#define sz size()
#define MOD 1000000007
#define rall(x) x.rbegin(),x.rend()
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const int N = 2e5 + 5;
int arr[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int check(int d, int m, int y){
m--;
if(d == 0) return 0;
if(d <= arr[m]) return 1;
if(d == 29 && m == 1 && y % 4 == 0) return 1;
return 0;
}
inline void solve(){
int n;
cin >> n;
for(int i = 0; i < n; i++){
string s;
cin >> s;
int year;
year = (s[6] - '0') * 1000 + (s[7] - '0') * 100 + (s[8] - '0') * 10 + (s[9] - '0');
if(s[3] > s[7]){
year++;
}
else if(s[3] < s[7]) year;
else if(s[4] > s[6]) year++;
else if(s[4] < s[6]) year;
else if(s[0] > s[9]) year++;
else if(s[0] < s[9]) year;
else if(s[1] >= s[8]) year++;
int year_in_arr[4];
year_in_arr[0] = year / 1000;
year %= 1000;
year_in_arr[1] = year / 100;
year %= 100;
year_in_arr[2] = year / 10;
year %= 10;
year_in_arr[3] = year;
year = year_in_arr[0] * 1000 + year_in_arr[1] * 100 + year_in_arr[2] * 10 + year_in_arr[3];
while(1){
int d = year_in_arr[3] * 10 + year_in_arr[2];
int m = year_in_arr[1] * 10 + year_in_arr[0];
int y = year;
if(check(d, m, y)){
cout << ((d < 10) ? "0" : "") << d << "." << ((m < 10) ? "0" : "") << m << "." << ((y < 10) ? "000" : ((y < 100) ? "00" : ((y < 1000) ? "0" : ""))) << y << "." << endl;
break;
}
year++;
year_in_arr[3]++;
if(year_in_arr[3] == 10) year_in_arr[3] = 0, year_in_arr[2]++;
if(year_in_arr[2] == 10) year_in_arr[2] = 0, year_in_arr[1]++;
if(year_in_arr[1] == 10) year_in_arr[1] = 0, year_in_arr[0]++;
}
}
}
int main(){
fast_io
int t;
t = 1;
while(t--) solve();
}
Compilation message
datum.cpp: In function 'void solve()':
datum.cpp:38:30: warning: statement has no effect [-Wunused-value]
38 | else if(s[3] < s[7]) year;
| ^~~~
datum.cpp:40:30: warning: statement has no effect [-Wunused-value]
40 | else if(s[4] < s[6]) year;
| ^~~~
datum.cpp:42:30: warning: statement has no effect [-Wunused-value]
42 | else if(s[0] < s[9]) year;
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
23 ms |
472 KB |
Output isn't correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Incorrect |
21 ms |
348 KB |
Output isn't correct |