Submission #472981

#TimeUsernameProblemLanguageResultExecution timeMemory
472981rainboyBirokracija (COCI18_birokracija)C11
100 / 100
61 ms6008 KiB
#include <stdio.h> #define N 200000 int main() { static int pp[N]; static long long ans[N]; int n, i; scanf("%d", &n); for (i = 1; i < n; i++) scanf("%d", &pp[i]), pp[i]--; for (i = 0; i < n; i++) ans[i] = 1; for (i = n - 1; i > 0; i--) ans[pp[i]] += ans[i]; for (i = n - 1; i > 0; i--) ans[pp[i]] += ans[i]; for (i = 0; i < n; i++) printf("%lld ", ans[i]); printf("\n"); return 0; }

Compilation message (stderr)

birokracija.c: In function 'main':
birokracija.c:10:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
birokracija.c:12:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf("%d", &pp[i]), pp[i]--;
      |   ^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...