Submission #1874632


Source Code Expand

Copy
#include <bits/stdc++.h>
 
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
typedef long long int ll;
using namespace std;

int main(void) {
    int N;
    map<int, int> m;
    cin >> N;
    REP(i, N) {
        int j;
        cin >> j;
        m[j]++;
    }
    int ans = 0;
    for(auto k : m) {
        if (k.second >= k.first) {
            ans += k.second - k.first;
        } else {
            ans += k.second;
        }

    } 
    cout << ans << endl;
}

Submission Info

Submission Time
Task C - Good Sequence
User kivantium
Language C++14 (GCC 5.4.1)
Score 300
Code Size 534 Byte
Status
Exec Time 74 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 17 ms 256 KB
1_03.txt 29 ms 256 KB
1_04.txt 32 ms 256 KB
1_05.txt 32 ms 256 KB
1_06.txt 44 ms 256 KB
1_07.txt 29 ms 256 KB
1_08.txt 38 ms 1152 KB
1_09.txt 47 ms 2048 KB
1_10.txt 56 ms 2944 KB
1_11.txt 66 ms 3968 KB
1_12.txt 74 ms 4736 KB