Submission #154168

# Submission time Handle Problem Language Result Execution time Memory
154168 2019-09-18T17:48:38 Z AlexPascu007 Baloni (COCI15_baloni) C++
100 / 100
346 ms 7320 KB
#include <iostream>
using namespace std;
int n,i,sol,v[1000010],f[1000010];
int main() {
    cin>>n;
    for (i=1;i<=n;i++)
        cin>>v[i];
    for (i=1;i<=n;i++) {
        if (f[v[i]]==0) {
            sol++;
            f[v[i]-1]++;
        }
        else {
            f[v[i]]--;
            f[v[i]-1]++;
        }
    }
    cout<<sol;
    return 0;
}
# 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 7272 KB Output is correct
6 Correct 346 ms 7320 KB Output is correct
7 Correct 279 ms 6136 KB Output is correct
8 Correct 269 ms 5964 KB Output is correct
9 Correct 303 ms 6504 KB Output is correct
10 Correct 300 ms 6776 KB Output is correct