# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
238825 |
2020-06-13T06:33:56 Z |
Exile_2k4 |
Datum (COCI20_datum) |
C++17 |
|
11 ms |
640 KB |
#include <bits/stdc++.h>
using namespace std;
int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
#define year tuple<int,int,int>
signed main(){
// freopen("datum.inp","r",stdin);
// freopen("datum.out","w",stdout);
int n;
scanf("%d",&n);
set<year> s;
for(int mm=1;mm<=12;++mm){
for(int dd=1;dd<=days[mm];++dd){
string d,m;
if(dd<10) d+="0";
if(mm<10) m+="0";
d+=to_string(dd),m+=to_string(mm);
string yy = d+m;
reverse(begin(yy),end(yy));
s.insert({stoi(yy),mm,dd});
}
}
for(int i=0;i<n;++i){
int d,m,y;
scanf("%d.%d.%d.",&d,&m,&y);
auto pick = s.lower_bound({y,m,d});
if(make_tuple(y,m,d)==*pick) pick = next(pick);
auto ans = *pick;
printf("%02d.%02d.%04d.\n",get<2>(ans),get<1>(ans),get<0>(ans));
}
}
Compilation message
datum.cpp: In function 'int main()':
datum.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
~~~~~^~~~~~~~~
datum.cpp:29:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d.%d.%d.",&d,&m,&y);
~~~~~^~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Incorrect |
11 ms |
640 KB |
Output isn't correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
11 ms |
640 KB |
Output is correct |