제출 #280128

#제출 시각아이디문제언어결과실행 시간메모리
2801283zpBaloni (COCI15_baloni)C++14
100 / 100
140 ms3984 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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);
      |         ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...