Submission #845145

# Submission time Handle Problem Language Result Execution time Memory
845145 2023-09-06T12:15:34 Z vjudge1 Datum (COCI20_datum) C++17
35 / 50
5 ms 600 KB
// clang-format off
#include <algorithm>
#include <bits/stdc++.h>
#include <cstddef>
#include <cstdio>
#include <string>
using namespace std;

#define ll long long
#define lg2(x) (63 - __builtin_clzll(x))
#define db cerr << "BREAK\n"
#define fp(...) fprintf(stderr, __VA_ARGS__)
#define rs(a) a.resize(n)
#define hizli cin.tie(0);ios_base::sync_with_stdio(0)
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(a, b) for (int a = 0; a < b; a++)
#define af(x) for(auto&a:x)fp("%d ",a);fp("\n")
#define ff first
#define ss second
#define job main
// clang-format on
template <typename... Args> void in(Args &&...args) {
  (std::cin >> ... >> args);
}
const int N = 2e5 + 5, MOD = 1e9 + 7;
/*
~Y .5. J~ ~J .5. 5: 77 :5  5: ?! ^Y ~J .5. Y^ ~? .5..Y^ !? .
^J .5. ?! ^J .5. Y: !7 :P^^G~.J7 ^Y ~J .5. Y^ ~J .5..Y^ 7? .
^Y .5. ?! ~J .5. Y^.Y##&&&@@&&&&G55 ^J .5. J~ ~? .5. Y~ !J .
^Y .5. J! ~J .5. 5#&@@@&&&@&@@@@@@&J!J .5. J~ ~J .5. Y^ !J .
:Y  5: ?! :Y .5^5&@@@@&&&&&&&@@@@&@@&5 .5. J~ ~J .5. Y~ ~Y .
:5  5: ?! ^Y  P&@&&&&&&&&&&&&&&&&&&&&&!.P. Y~ ^J .5. Y~ ~J..
.5. Y: 77 ^Y .B&&&&&&&&&&&&&&B5YYG&&&@&:5. J! ~Y .5. J~ ~J .
.5. Y^ 77 ^Y ?&&&&&&&&&&&B5J7!7??JP&&@@YY. ?! ~Y .5. Y~ ~Y .
.5  Y^ !7 ^Y J#BP5555B#G7~~~!!7?JY5B@@@P5: J! ~J .P. J~ ~J..
.5  5: 7? ^Y ~&#5J?7!7?!!77!!!!7?J5P#@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&&&@@
 Y&&&&&&&&&&&&&&&&&&&&&&@@@@@@@@&&&&&&&&&&&&&&&&&&&&&&&&@&@@*/
vector<pair<int, string>> sol;
int job() {
  int n;
  cin >> n;
  vector<int> days = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  for (int i = 0; i < 12; i++) {
    string day, month;
    string ct;
    for (int d = 1; d <= days[i]; d++) {
      day = to_string(d);
      if (d < 10) {
        day = "0" + day;
      }
      month = to_string(i + 1);
      if (i < 9) {
        month = "0" + month;
      }
      ct = day + month;
      reverse(ct.begin(), ct.end());
      string tmp = day + month + ct;
      int year = (ct[0] - '0') * 1000 + (ct[1] - '0') * 100 +
                 (ct[2] - '0') * 10 + (ct[3] - '0');
      sol.pb({year, tmp});
    }
  }
  sol.pb({2092, "29022092"});
  sort(all(sol));
  while (n--) {
    int day, mon, year;
    scanf("%d.%d.%d.", &day, &mon, &year);
    string d, m, y;
    d = to_string(day);
    m = to_string(mon);
    y = to_string(year);
    int tempyear=year;
    while((tempyear*=10)<=10000){
      y="0"+y;
    }
    reverse(all(y));
    if (day < 10) {
      d = "0" + d;
    }
    if (mon < 10) {
      m = "0" + m;
    }
    if (d + m == y) {
      year++;
    }
    string s = (*lower_bound(all(sol), pair<int, string>{year, ""})).ss;
    printf("%c%c.%c%c.%c%c%c%c.\n",s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7]);
  }
}

Compilation message

datum.cpp: In function 'int main()':
datum.cpp:86:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   86 |     scanf("%d.%d.%d.", &day, &mon, &year);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Incorrect 5 ms 348 KB Output isn't correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Incorrect 5 ms 348 KB Output isn't correct