Submission #479345

# Submission time Handle Problem Language Result Execution time Memory
479345 2021-10-11T12:40:08 Z rainboy Titlovi (COCI19_titlovi) C
50 / 50
1 ms 204 KB
#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

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 time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct