Submission #850715

# Submission time Handle Problem Language Result Execution time Memory
850715 2023-09-17T10:27:13 Z raphaelp Baloni (COCI15_baloni) C++14
100 / 100
139 ms 11292 KB
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> Tab(N);
    for (int i = 0; i < N; i++)
    {
        cin >> Tab[i];
    }
    vector<int> arrows(1000001, 0);
    int tot = 0;
    for (int i = 0; i < N; i++)
    {
        if (arrows[Tab[i]] > 0)
        {
            arrows[Tab[i]]--;
        }
        else
        {
            tot++;
        }
        arrows[Tab[i] - 1]++;
    }
    cout << tot;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4184 KB Output is correct
2 Correct 2 ms 4184 KB Output is correct
3 Correct 2 ms 4188 KB Output is correct
4 Correct 2 ms 4184 KB Output is correct
5 Correct 137 ms 10796 KB Output is correct
6 Correct 139 ms 11292 KB Output is correct
7 Correct 112 ms 9812 KB Output is correct
8 Correct 110 ms 9768 KB Output is correct
9 Correct 122 ms 10320 KB Output is correct
10 Correct 120 ms 10576 KB Output is correct