Submission #51597405


Source Code Expand

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

int main(){
    int n,a;
    long long k,ans;
    cin>>n>>k;
    ans=k*(k+1)/2;
    set<int> s;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a<=k && s.count(a)==0){
            s.insert(a);
            ans-=a;
        }
    }
    cout<<ans<<endl;
}

Submission Info

Submission Time
Task C - Σ
User iwzk
Language C++ 20 (gcc 12.2)
Score 250
Code Size 320 Byte
Status AC
Exec Time 118 ms
Memory 12816 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 3452 KiB
00_sample_01.txt AC 1 ms 3516 KiB
00_sample_02.txt AC 1 ms 3520 KiB
01_random_00.txt AC 59 ms 7708 KiB
01_random_01.txt AC 96 ms 10220 KiB
01_random_02.txt AC 97 ms 11304 KiB
01_random_03.txt AC 117 ms 12800 KiB
01_random_04.txt AC 16 ms 4420 KiB
01_random_05.txt AC 60 ms 5280 KiB
01_random_06.txt AC 82 ms 9888 KiB
01_random_07.txt AC 118 ms 11972 KiB
01_random_08.txt AC 37 ms 4048 KiB
01_random_09.txt AC 99 ms 10632 KiB
01_random_10.txt AC 36 ms 6748 KiB
01_random_11.txt AC 117 ms 12816 KiB
02_random2_00.txt AC 52 ms 3416 KiB
02_random2_01.txt AC 51 ms 3440 KiB
02_random2_02.txt AC 51 ms 3516 KiB
03_handmade_00.txt AC 52 ms 3628 KiB
03_handmade_01.txt AC 52 ms 3444 KiB
03_handmade_02.txt AC 32 ms 3548 KiB
03_handmade_03.txt AC 33 ms 3516 KiB