Submission #479345

#TimeUsernameProblemLanguageResultExecution timeMemory
479345rainboyTitlovi (COCI19_titlovi)C11
50 / 50
1 ms204 KiB
#include <stdio.h> #include <string.h> #define K 30 #define L 16384 #define T 86400000 int main() { static char buf[L], txt[K][L]; static int xx[K], ll[K], rr[K]; int k, h, t; k = 0; while (1) { int h1, m1, s1, ms1, h2, m2, s2, ms2; char *ptr; fgets(buf, L, stdin), sscanf(buf, "%d", &xx[k]); fgets(buf, L, stdin), sscanf(buf, "%d:%d:%d,%d --> %d:%d:%d,%d", &h1, &m1, &s1, &ms1, &h2, &m2, &s2, &ms2); ll[k] = ((h1 * 60 + m1) * 60 + s1) * 1000 + ms1; rr[k] = ((h2 * 60 + m2) * 60 + s2) * 1000 + ms2; ptr = txt[k++]; while (1) { char c; fgets(ptr, L, stdin); c = ptr[0], ptr += strlen(ptr); if (c == '\n') break; if (c == '#') goto out; } } out: fgets(buf, L, stdin), sscanf(buf, "%d", &t); for (h = 0; h < k; h++) { int l = (ll[h] + t + T) % T, r = (rr[h] + t + T) % T; printf("%d\n", xx[h]); printf("%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d\n", l / 1000 / 60 / 60, l / 1000 / 60 % 60, l / 1000 % 60, l % 1000, r / 1000 / 60 / 60, r / 1000 / 60 % 60, r / 1000 % 60, r % 1000); printf("%s", txt[h]); } return 0; }

Compilation message (stderr)

titlovi.c: In function 'main':
titlovi.c:18:3: warning: ignoring return value of 'fgets' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   fgets(buf, L, stdin), sscanf(buf, "%d", &xx[k]);
      |   ^~~~~~~~~~~~~~~~~~~~
titlovi.c:19:3: warning: ignoring return value of 'fgets' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |   fgets(buf, L, stdin), sscanf(buf, "%d:%d:%d,%d --> %d:%d:%d,%d",
      |   ^~~~~~~~~~~~~~~~~~~~
titlovi.c:28:4: warning: ignoring return value of 'fgets' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |    fgets(ptr, L, stdin);
      |    ^~~~~~~~~~~~~~~~~~~~
titlovi.c:37:2: warning: ignoring return value of 'fgets' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |  fgets(buf, L, stdin), sscanf(buf, "%d", &t);
      |  ^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...