Submission #156130

# Submission time Handle Problem Language Result Execution time Memory
156130 2019-10-03T15:05:21 Z mdn2002 Baloni (COCI15_baloni) C++14
100 / 100
343 ms 3840 KB
#include<bits/stdc++.h>
using namespace std;
long long mod=1e9+7;
int n,a[1000006],num[1000006],ans;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(num[a[i]+1]>0)
        {
            num[a[i]+1]--;
        }
        else ans++;
        num[a[i]]++;
    }
    cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 4 ms 376 KB Output is correct
5 Correct 332 ms 3540 KB Output is correct
6 Correct 343 ms 3840 KB Output is correct
7 Correct 270 ms 3192 KB Output is correct
8 Correct 267 ms 3396 KB Output is correct
9 Correct 303 ms 3320 KB Output is correct
10 Correct 298 ms 3408 KB Output is correct