Submission #315158

#TimeUsernameProblemLanguageResultExecution timeMemory
315158Kesatria_KomodoBaloni (COCI15_baloni)C++17
100 / 100
121 ms7448 KiB
#include <cstdio> int frek[1000001]; int main(){ int N; scanf("%d" , &N); int arr[N] , ans = 0; for (int i = 0 ; i < N ; i++) scanf("%d" , arr + i); for (int i = N - 1 ; i >= 0 ; i--){ if (!frek[arr[i] - 1]) ++ans; else --frek[arr[i] - 1]; ++frek[arr[i]]; } printf("%d\n" , ans); }

Compilation message (stderr)

baloni.cpp: In function 'int main()':
baloni.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    5 |     scanf("%d" , &N);
      |     ~~~~~^~~~~~~~~~~
baloni.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    8 |         scanf("%d" , arr + i);
      |         ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...