#include <stdio.h>
#include <string.h>
#define N 1000
int main() {
static char cc[N][32];
static int aa[N], bb[N];
int n, m, i, j, a, b, cnt;
scanf("%d%d", &n, &m);
for (i = 0; i < n; i++) {
scanf("%s", cc[i]);
for (j = 0; j < m; j++) {
static char str[16];
int k, h, m, s;
scanf("%s", str);
if (str[0] == '-')
continue;
sscanf(str, "%*c%d/%d:%d:%d", &k, &h, &m, &s);
aa[i]++, bb[i] += k * 20 * 60 + (h * 60 + m) * 60 + s;
}
}
scanf("%*s");
a = b = 0;
for (j = 0; j < m; j++) {
static char str[16];
int k, h, m, s;
scanf("%s", str);
if (str[0] == '+') {
sscanf(str, "%*c%d/%d:%d:%d", &k, &h, &m, &s);
a++, b += k * 20 * 60 + (h * 60 + m) * 60 + s;
}
}
cnt = 1;
for (i = 0; i < n; i++) {
int c = strcmp(cc[i], "NijeZivotJedanACM");
if (c == 0)
continue;
if (a < aa[i] || a == aa[i] && (b > bb[i] || b == bb[i] && c < 0))
cnt++;
}
printf("%d\n", cnt);
return 0;
}
Compilation message
acm.c: In function 'main':
acm.c:43:59: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
43 | if (a < aa[i] || a == aa[i] && (b > bb[i] || b == bb[i] && c < 0))
| ~~~~~~~~~~~^~~~~~~~
acm.c:43:31: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
43 | if (a < aa[i] || a == aa[i] && (b > bb[i] || b == bb[i] && c < 0))
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
acm.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
11 | scanf("%d%d", &n, &m);
| ^~~~~~~~~~~~~~~~~~~~~
acm.c:13:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
13 | scanf("%s", cc[i]);
| ^~~~~~~~~~~~~~~~~~
acm.c:18:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
18 | scanf("%s", str);
| ^~~~~~~~~~~~~~~~
acm.c:25:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
25 | scanf("%*s");
| ^~~~~~~~~~~~
acm.c:31:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
31 | scanf("%s", str);
| ^~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
5 ms |
332 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
6 ms |
428 KB |
Output is correct |
5 |
Correct |
6 ms |
460 KB |
Output is correct |