답안 #315158

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
315158 2020-10-22T03:35:28 Z Kesatria_Komodo Baloni (COCI15_baloni) C++17
100 / 100
121 ms 7448 KB
#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

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);
      |         ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 109 ms 7052 KB Output is correct
6 Correct 121 ms 7448 KB Output is correct
7 Correct 93 ms 6136 KB Output is correct
8 Correct 98 ms 6008 KB Output is correct
9 Correct 102 ms 6580 KB Output is correct
10 Correct 102 ms 6520 KB Output is correct