Submission #484284

#TimeUsernameProblemLanguageResultExecution timeMemory
484284rainboyPo (COCI21_po)C11
70 / 70
14 ms812 KiB
#include <stdio.h> #define N 100000 int main() { static int aa[N], qu[N]; int n, i, cnt, ans; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &aa[i]); ans = n, cnt = 0; for (i = 0; i < n; i++) { while (cnt && aa[qu[cnt - 1]] > aa[i]) cnt--; if (aa[i] == 0 || cnt && aa[qu[cnt - 1]] == aa[i]) ans--; qu[cnt++] = i; } printf("%d\n", ans); return 0; }

Compilation message (stderr)

Main.c: In function 'main':
Main.c:16:25: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   16 |   if (aa[i] == 0 || cnt && aa[qu[cnt - 1]] == aa[i])
      |                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
Main.c:11:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   scanf("%d", &aa[i]);
      |   ^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...