Submission #88803

# Submission time Handle Problem Language Result Execution time Memory
88803 2018-12-08T20:13:35 Z asifthegreat Baloni (COCI15_baloni) C++14
100 / 100
107 ms 4072 KB
#include <bits/stdc++.h>
using namespace std;

#define debug(a) cout << #a << " = " << a << endl

const int N = 1000004;

int ara[N],n;
int taken[N];

int main()
{
    scanf("%d",&n);
    for(int i = 0; i < n;i++)scanf("%d",&ara[i]);
    int cnt = 0;
    for(int i = 0; i < n;i++){
        taken[ara[i]]++;
        cnt++;
        if(taken[ara[i]+1]){
            cnt--;
            taken[ara[i]+1]--;
        }
    }
    cout << cnt << endl;
    return 0;
}

Compilation message

baloni.cpp: In function 'int main()':
baloni.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
baloni.cpp:14:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 0; i < n;i++)scanf("%d",&ara[i]);
                              ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 464 KB Output is correct
3 Correct 3 ms 540 KB Output is correct
4 Correct 3 ms 540 KB Output is correct
5 Correct 97 ms 3548 KB Output is correct
6 Correct 107 ms 4072 KB Output is correct
7 Correct 83 ms 4072 KB Output is correct
8 Correct 84 ms 4072 KB Output is correct
9 Correct 90 ms 4072 KB Output is correct
10 Correct 94 ms 4072 KB Output is correct