답안 #845094

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
845094 2023-09-06T11:55:32 Z vjudge1 Datum (COCI20_datum) C++17
0 / 50
1000 ms 14420 KB
// Imagine not FFT
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
#ifndef ONLINE_JUDGE
    #define DEBUG(x) std::cerr << #x << ": " << x << std::endl;
    #define DEBUGV(x) std::cerr << #x << ": { "; for(auto ___y:x) std::cerr << ___y << " "; std::cerr << "}" << std::endl;
    #define DEBUGVV(x) std::cerr << #x << ": { \n"; for(int _i=0;_i<sz(x);++_i) {DEBUGV(x[_i]);} std::cerr << "}" << std::endl;
	#define DEBUGVP(x) std::cerr << #x << ": { "; for(auto ___y:x) std::cerr << "{" << ___y.first << "," << ___y.second << "}" << " "; std::cerr << "}" << std::endl;
	#define files freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
    #define fastio std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr);
#else
    #define fastio std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr);
    #define DEBUG(...) void(23)
    #define DEBUGV(x) void(23);
    #define DEBUGARR(arr, size) void(23)
    #define DEBUGPRINT(...) void(23)
    #define DEBUGMAP(...) void(23)
    #define DEBUGMAPQUEUE(...) void(23)
    #define DEBUGVV(x) void(23);
    #define DEBUGVP(x) void(23);
    #define files void(23);
#endif

#define int long long
#define ll long long
 
#define pb push_back
#define ff first
#define ss second
#define pii std::pair < int , int >
#define pll std::pair < ll , ll >
#define vi std::vector < ll >
#define vl std::vector < int >
#define vii std::vector < pii >
#define vll std::vector < pll >
#define vvi std::vector < vi >
#define vvii std::vector < vii >
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define forn(i,j) for(int i=0;i<j;i++)
#define forr(i,j,k) for(int i=j;i<k;i++)
 
#define mset multiset
#define pqueue priority_queue
#define cmax(a,b) (a = max(a,b))
#define cmin(a,b) (a = min(a,b))
 
#define sz(a) (int)(a.size())
     
const int MOD = 1000000007;
const int MOD2 = 998244353;

using namespace std;

vi mx = {31,28,31,30,31,30,31,31,30,31,30,31};

void solve(int _t_case){
	int n;
	cin >> n;
	while(n--){
		string s;
		cin >> s;
		int day = (s[0]-'0')*10+(s[1]-'0');
		int month = (s[3]-'0')*10+(s[4]-'0');
		int year = (s[6]-'0')*1000+(s[7]-'0')*100+(s[8]-'0')*10+(s[9]-'0');
		if(day>=year%100/10+year%10*10 && month>=year/100%10*10+year/1000) ++year;
		int oldyear = year;
		while(year/100%10*10+year/1000>=12) year+=100;
		if(year!=oldyear) year=year/100*100;
		do{
			month = year/100%10*10+year/1000;
			while(year%10>3 || (year%10==3 && year%100/10+year%10*10>31) || (year%100==0)) ++year;
		}while(mx[month-1]<day && (month!=2 || day!=29));
		day = year%100/10+year%10*10;
		month = year/100%10*10+year/1000;
		string ds = to_string(day);
		string dm = to_string(month);
		string dy = to_string(year);
		if(ds.length()<2) ds = "0" + ds;
		if(dm.length()<2) dm = "0" + dm;
		while(dy.length()<4) dy = "0" + dy;
		cout << ds << "." << dm << "." << dy << "." << endl;
	}
	return;
}

signed main(){
    fastio;
    files;
    int t=1,_t=0;
//    std::cin >> t;
    while(_t<t){
        ++_t;
        solve(_t);
    }
    return 0;
}

Compilation message

datum.cpp: In function 'int main()':
datum.cpp:16:23: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |  #define files freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
      |                ~~~~~~~^~~~~~~~~~~~~~~~~~~~
datum.cpp:96:5: note: in expansion of macro 'files'
   96 |     files;
      |     ^~~~~
datum.cpp:16:51: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |  #define files freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
      |                                            ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
datum.cpp:96:5: note: in expansion of macro 'files'
   96 |     files;
      |     ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1045 ms 13936 KB Time limit exceeded
2 Execution timed out 1022 ms 13492 KB Time limit exceeded
3 Execution timed out 1059 ms 14340 KB Time limit exceeded
4 Execution timed out 1067 ms 13832 KB Time limit exceeded
5 Execution timed out 1062 ms 14152 KB Time limit exceeded
6 Execution timed out 1058 ms 14368 KB Time limit exceeded
7 Execution timed out 1060 ms 13852 KB Time limit exceeded
8 Execution timed out 1050 ms 14264 KB Time limit exceeded
9 Execution timed out 1054 ms 13432 KB Time limit exceeded
10 Execution timed out 1072 ms 14420 KB Time limit exceeded