Submission #51572113


Source Code Expand

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) begin(v), end(v)
using namespace std;
using P = pair<int,int>;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

int main() {
    int n, k;
    cin >> n >> k;

    vi a(n);

    unordered_set<int> seen; 

    rep(i, n) {
        cin >> a[i];
        if (a[i] <= k)
            seen.insert(a[i]);
    }

    ll sum_of_seen = 0; 
    for (int x : seen)
        sum_of_seen += x;

    ll sum_of_all = (ll)k * (k + 1) / 2;

    cout << sum_of_all - sum_of_seen << endl;
    return 0;
}

Submission Info

Submission Time
Task C - Σ
User Anthony1009
Language C++ 20 (gcc 12.2)
Score 250
Code Size 626 Byte
Status AC
Exec Time 94 ms
Memory 13372 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 250 / 250
Status
AC × 3
AC × 22
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 03_handmade_00.txt, 03_handmade_01.txt, 03_handmade_02.txt, 03_handmade_03.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3532 KiB
00_sample_01.txt AC 1 ms 3468 KiB
00_sample_02.txt AC 1 ms 3528 KiB
01_random_00.txt AC 47 ms 8560 KiB
01_random_01.txt AC 75 ms 9724 KiB
01_random_02.txt AC 70 ms 10316 KiB
01_random_03.txt AC 94 ms 13372 KiB
01_random_04.txt AC 14 ms 4064 KiB
01_random_05.txt AC 56 ms 5600 KiB
01_random_06.txt AC 59 ms 9468 KiB
01_random_07.txt AC 90 ms 13256 KiB
01_random_08.txt AC 35 ms 4132 KiB
01_random_09.txt AC 74 ms 10112 KiB
01_random_10.txt AC 26 ms 6244 KiB
01_random_11.txt AC 86 ms 13372 KiB
02_random2_00.txt AC 52 ms 3872 KiB
02_random2_01.txt AC 52 ms 3884 KiB
02_random2_02.txt AC 51 ms 3920 KiB
03_handmade_00.txt AC 52 ms 3836 KiB
03_handmade_01.txt AC 53 ms 3948 KiB
03_handmade_02.txt AC 34 ms 3852 KiB
03_handmade_03.txt AC 33 ms 3928 KiB