Submission #153876

# Submission time Handle Problem Language Result Execution time Memory
153876 2019-09-17T06:23:14 Z nicolaalexandra Baloni (COCI15_baloni) C++14
100 / 100
330 ms 452 KB
#include <iostream>

using namespace std;

int n,i,j,x,sol;
int f[1000010];
int main (){

    cin>>n;
    for (i=1;i<=n;i++){
        cin>>x;
        if (f[x+1]){
            f[x+1]--;
            f[x]++;
        } else {
            sol++;
            f[x]++;
        }}
    cout<<sol;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 330 ms 372 KB Output is correct
6 Correct 329 ms 368 KB Output is correct
7 Correct 274 ms 400 KB Output is correct
8 Correct 278 ms 452 KB Output is correct
9 Correct 296 ms 368 KB Output is correct
10 Correct 292 ms 376 KB Output is correct