Submission #845177

#TimeUsernameProblemLanguageResultExecution timeMemory
845177vjudge1Datum (COCI20_datum)C++14
50 / 50
284 ms528 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...