1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#include <cstdio>

  int main() {
      int x, d, h, m;
      scanf("%d %d %d %d", &x, &d, &h, &m);

      // Each round's deadline is effectively midnight (00:00) of the next day
      int dd[] = {0, 25, 26, 27, 28, 30};

      // Convert local time to absolute minutes from March 23 00:00,
      // accounting for DST (clocks skip 2:00→3:00 on March 29)
      auto abs_min = [](int day, int hour, int min) {
          int r = (day - 23) * 1440 + hour * 60 + min;
          if (day > 29 || (day == 29 && hour >= 3))
              r -= 60;
          return r;
      };

      printf("%d\n", abs_min(dd[x], 0, 0) - abs_min(d, h, m));
  }