# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
845177 |
2023-09-06T12:27:45 Z |
vjudge1 |
Datum (COCI20_datum) |
C++14 |
|
284 ms |
528 KB |
#include <bits/stdc++.h>
using namespace std;
vector<int> lens = {-1, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
void solve(void){
string s;
cin >> s;
int m, d, y;
d = (s[0]-'0')*10 + s[1]-'0';
m = (s[3]-'0')*10 + s[4]-'0';
y = ( (s[6]-'0')*10 + s[7]-'0' )*100 + (s[8]-'0')*10 + s[9]-'0';
vector<vector<int>> pal;
for(int month = 1; month<=12; month++){
for(int day=1; day<=lens[month]; day++){
int year = ( (day/10) + (day%10)*10 + (month/10)*100 + (month%10)*1000 );
pal.push_back({year, month, day});
}
}
sort(pal.begin(), pal.end());
vector<int> bruh = {y, m, d};
for(int i=0; i<pal.size(); i++){
if( bruh < pal[i] ){
printf("%.2d.%.2d.%.4d.\n", pal[i][2], pal[i][1], pal[i][0]);
break;
}
}
}
int main(){
int t=1;
cin >> t;
while(t--)
solve();
return 0;
}
Compilation message
datum.cpp: In function 'void solve()':
datum.cpp:28:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
28 | for(int i=0; i<pal.size(); i++){
| ~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
284 ms |
476 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
234 ms |
528 KB |
Output is correct |