Submission #42720

# Submission time Handle Problem Language Result Execution time Memory
42720 2018-03-03T05:44:06 Z theknife2001 Baloni (COCI15_baloni) C++14
100 / 100
238 ms 19896 KB
#include <bits/stdc++.h>


using namespace std;
const int N=1e6+55;
int b[N];


int main()
{
    int ans=0;
    int n;
    cin>>n;
    int x;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        if(b[x]==0)
        {
            ans++;
            b[x-1]++;
        }
        else
        {
            b[x]--;
            b[x-1]++;
        }
    }
    cout<<ans<<endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 3 ms 732 KB Output is correct
5 Correct 235 ms 4472 KB Output is correct
6 Correct 238 ms 7984 KB Output is correct
7 Correct 200 ms 10784 KB Output is correct
8 Correct 176 ms 13624 KB Output is correct
9 Correct 203 ms 16792 KB Output is correct
10 Correct 201 ms 19896 KB Output is correct