답안 #280128

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
280128 2020-08-22T13:55:59 Z 3zp Baloni (COCI15_baloni) C++14
100 / 100
140 ms 3984 KB
#include<bits/stdc++.h>
using namespace std;
int f[1000009];
main(){
    int n;
    int ans = 0;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        int h;
        scanf("%d", &h);
        if(f[h+1]) f[h+1]--, f[h]++;
        else ans++, f[h]++;
    }
    cout << ans << endl;
}

Compilation message

baloni.cpp:4:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      |      ^
baloni.cpp: In function 'int main()':
baloni.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
baloni.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |         scanf("%d", &h);
      |         ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 416 KB Output is correct
5 Correct 111 ms 3984 KB Output is correct
6 Correct 140 ms 3848 KB Output is correct
7 Correct 95 ms 3368 KB Output is correct
8 Correct 90 ms 3192 KB Output is correct
9 Correct 100 ms 3580 KB Output is correct
10 Correct 114 ms 3448 KB Output is correct