Submission #56532089


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve(){
int q;cin>>q;
map<int,int>mp;
while(q--){
int op,x;cin>>op;
if(op==1){
cin>>x;
mp[x]++;
}else if(op==2){
cin>>x;
mp[x]--;
if(mp[x]==0){
mp.erase(x);
}
}else{
cout<<mp.size()<<'\n';
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>
using namespace std;
#define int long long

void solve(){
    int q;cin>>q;
    map<int,int>mp;
    while(q--){
        int op,x;cin>>op;
        if(op==1){
            cin>>x;
            mp[x]++;
        }else if(op==2){
            cin>>x;
            mp[x]--;
            if(mp[x]==0){
                mp.erase(x);
            }
        }else{
            cout<<mp.size()<<'\n';
        }
    }
}
signed main(){
    ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);
    // int t;cin>>t;while(t--)
    solve();
}

Submission Info

Submission Time
Task C - Balls and Bag Query
User chronicle12345
Language C++ 20 (gcc 12.2)
Score 300
Code Size 564 Byte
Status AC
Exec Time 80 ms
Memory 14792 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 25
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.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, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3376 KB
00_sample_01.txt AC 1 ms 3456 KB
01_random_00.txt AC 54 ms 11196 KB
01_random_01.txt AC 54 ms 11188 KB
01_random_02.txt AC 54 ms 11240 KB
01_random_03.txt AC 53 ms 11128 KB
01_random_04.txt AC 55 ms 11268 KB
01_random_05.txt AC 55 ms 11784 KB
01_random_06.txt AC 54 ms 11868 KB
01_random_07.txt AC 55 ms 11864 KB
01_random_08.txt AC 55 ms 11812 KB
01_random_09.txt AC 58 ms 11824 KB
01_random_10.txt AC 19 ms 3448 KB
01_random_11.txt AC 20 ms 3488 KB
01_random_12.txt AC 24 ms 3532 KB
01_random_13.txt AC 24 ms 3480 KB
01_random_14.txt AC 30 ms 3468 KB
01_random_15.txt AC 30 ms 3540 KB
01_random_16.txt AC 36 ms 4100 KB
01_random_17.txt AC 37 ms 3948 KB
01_random_18.txt AC 80 ms 14792 KB
01_random_19.txt AC 41 ms 9424 KB
01_random_20.txt AC 61 ms 9480 KB
01_random_21.txt AC 62 ms 9400 KB
01_random_22.txt AC 62 ms 9424 KB


2025-04-26 (Sat)
04:18:57 +00:00