Submission #100759

# Submission time Handle Problem Language Result Execution time Memory
100759 2019-03-14T08:00:45 Z dalgerok Baloni (COCI15_baloni) C++17
100 / 100
86 ms 7908 KB
#include<bits/stdc++.h>
using namespace std;




int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n, x;
    cin >> n;
    int ans = 0;
    int q[1000005];
    memset(q, 0, sizeof(q));
    for(int i = 1; i <= n; i++){
        cin >> x;
        if(q[x + 1] > 0){
            q[x] += 1;
            q[x + 1] -= 1;
        }
        else{
            ans += 1;
            q[x] += 1;
        }
    }
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4224 KB Output is correct
2 Correct 7 ms 4224 KB Output is correct
3 Correct 6 ms 4352 KB Output is correct
4 Correct 6 ms 4352 KB Output is correct
5 Correct 86 ms 7908 KB Output is correct
6 Correct 81 ms 7800 KB Output is correct
7 Correct 68 ms 7160 KB Output is correct
8 Correct 63 ms 7032 KB Output is correct
9 Correct 71 ms 7416 KB Output is correct
10 Correct 68 ms 7468 KB Output is correct