# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
238827 | Exile_2k4 | Datum (COCI20_datum) | C++17 | 11 ms | 512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int days[13] = {0, 31, 29, 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));
if(dd==29 && stoi(yy)%4) continue;
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));
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |