Submission #432518

#TimeUsernameProblemLanguageResultExecution timeMemory
432518rainboyPoi (IOI09_poi)C11
100 / 100
493 ms15928 KiB
#include <stdio.h> #define N 2000 #define T 2000 int main() { static int aa[N][T], kk[T], ss[N], tt[N]; int n, t, p, i, j, rank; scanf("%d%d%d", &n, &t, &p), p--; for (i = 0; i < n; i++) for (j = 0; j < t; j++) { scanf("%d", &aa[i][j]); if (aa[i][j]) kk[j]++; } for (i = 0; i < n; i++) for (j = 0; j < t; j++) if (aa[i][j]) ss[i] += n - kk[j], tt[i]++; rank = 0; for (i = 0; i < n; i++) if (ss[i] > ss[p] || ss[i] == ss[p] && (tt[i] > tt[p] || tt[i] == tt[p] && i <= p)) rank++; printf("%d %d\n", ss[p], rank); return 0; }

Compilation message (stderr)

poi.c: In function 'main':
poi.c:23:75: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   23 |   if (ss[i] > ss[p] || ss[i] == ss[p] && (tt[i] > tt[p] || tt[i] == tt[p] && i <= p))
      |                                                            ~~~~~~~~~~~~~~~^~~~~~~~~
poi.c:23:39: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   23 |   if (ss[i] > ss[p] || ss[i] == ss[p] && (tt[i] > tt[p] || tt[i] == tt[p] && i <= p))
      |                        ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
poi.c:10:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  scanf("%d%d%d", &n, &t, &p), p--;
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
poi.c:13:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |    scanf("%d", &aa[i][j]);
      |    ^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...