Submission #6015593


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int N;
    cin >> N;

    map<int, int> app;
    for (int i = 0, v; i < N; i++) {
        cin >> v;
        app[v]++;
    }

    int rem = 0;
    for (auto p : app)
        if (p.second >= p.first) rem += p.second - p.first;
        else rem += p.second;
    cout << rem << endl;

    return 0;
}

Submission Info

Submission Time
Task C - Good Sequence
User socketnaut
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1022 Byte
Status
Exec Time 45 ms
Memory 4736 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt
All 300 / 300 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt
Case Name Status Exec Time Memory
0_00.txt 1 ms 256 KB
0_01.txt 1 ms 256 KB
0_02.txt 1 ms 256 KB
0_03.txt 1 ms 256 KB
0_04.txt 1 ms 256 KB
1_00.txt 1 ms 256 KB
1_01.txt 1 ms 256 KB
1_02.txt 7 ms 256 KB
1_03.txt 9 ms 256 KB
1_04.txt 10 ms 256 KB
1_05.txt 10 ms 256 KB
1_06.txt 12 ms 256 KB
1_07.txt 10 ms 256 KB
1_08.txt 16 ms 1152 KB
1_09.txt 24 ms 2176 KB
1_10.txt 30 ms 3072 KB
1_11.txt 38 ms 3968 KB
1_12.txt 45 ms 4736 KB