Submission #6022396


Source Code Expand

Copy
#pragma region include
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstdio>
#include <tuple>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
#define MOD (1e9+7)
#define INF (1e9)
#define LLINF (4e18)
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
void input() {}
template<typename... R> void input(int& f, R&... r) { scanf("%d", &f); input(r...); }
template<typename... R> void input(double& f, R&... r) { scanf("%lf", &f); input(r...); }
template<typename... R> void input(ll& f, R&... r) { scanf("%lld", &f); input(r...); }
template<typename... R> void input(char& f, R&... r) { scanf("%c", &f); input(r...); }
template<typename... R> void input(string& f, R&... r) { cin >> f; input(r...); }
template<typename T, typename... R> void input(vector<T>& f, R&... r) { REP(i, f.size())input(f[i]); input(r...); }
#pragma endregion

int main() {
    int N; input(N);
    map<int, int> mp;
    REP(i, N) {
        int a; input(a);
        mp[a]++;
    }
    int ans = 0;
    for (auto m : mp) {
        if (m.first > m.second) {
            ans += m.second;
        }
        else {
            ans += m.second - m.first;
        }
    }
    cout << ans << endl;
    getchar(); getchar();
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘void input(int&, R& ...) [with R = {}]’:
./Main.cpp:27:55: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 template<typename... R> void input(int& f, R&... r) { scanf("%d", &f); input(r...); }
                                                       ^

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 9 ms 256 KB
1_03.txt 10 ms 256 KB
1_04.txt 11 ms 256 KB
1_05.txt 11 ms 256 KB
1_06.txt 13 ms 256 KB
1_07.txt 11 ms 256 KB
1_08.txt 18 ms 1152 KB
1_09.txt 25 ms 2048 KB
1_10.txt 33 ms 2944 KB
1_11.txt 41 ms 3968 KB
1_12.txt 48 ms 4736 KB