Submission #62274054
Source Code Expand
Copy
#include<bits/stdc++.h>#define ll long long#define ld long double#define pb push_back#define gcd __gcd#define MOD 1000000007#define inti __int128_t#define lset 63-__builtin_clzll#define fset __builtin_ctzll#define stcnt __builtin_popcountll#define pll pair<ll,ll>using namespace std;int main(){ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);ll t;t=1;
#include<bits/stdc++.h> #define ll long long #define ld long double #define pb push_back #define gcd __gcd #define MOD 1000000007 #define inti __int128_t #define lset 63-__builtin_clzll #define fset __builtin_ctzll #define stcnt __builtin_popcountll #define pll pair<ll,ll> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll t; t=1; while(t--){ ll n,q; cin>>n>>q; vector<ll>arr(n,1); ll cnt = 0; vector<ll>nest(n); for(ll i=0;i<n;i++)nest[i]=i; for(ll i=0;i<q;i++){ ll a; cin>>a; if(a==1){ ll p,h; cin>>p>>h; p--; h--; ll prev = nest[p]; arr[prev]--; if(arr[prev]==1)cnt--; nest[p]=h; arr[h]++; if(arr[h]==2)cnt++; }else{ cout<<cnt<<endl; } } } }
Submission Info
Submission Time | |
---|---|
Task | C - Pigeonhole Query |
User | MayankBhakat |
Language | C++ 20 (gcc 12.2) |
Score | 300 |
Code Size | 856 Byte |
Status | AC |
Exec Time | 285 ms |
Memory | 18720 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt, 00_sample_01.txt |
All | 00_sample_00.txt, 00_sample_01.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt, 01_test_31.txt, 01_test_32.txt, 01_test_33.txt, 01_test_34.txt, 01_test_35.txt, 01_test_36.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 1 ms | 3436 KB |
00_sample_01.txt | AC | 1 ms | 3524 KB |
01_test_00.txt | AC | 1 ms | 3508 KB |
01_test_01.txt | AC | 1 ms | 3528 KB |
01_test_02.txt | AC | 1 ms | 3432 KB |
01_test_03.txt | AC | 5 ms | 3596 KB |
01_test_04.txt | AC | 44 ms | 4652 KB |
01_test_05.txt | AC | 114 ms | 3520 KB |
01_test_06.txt | AC | 278 ms | 3464 KB |
01_test_07.txt | AC | 285 ms | 18480 KB |
01_test_08.txt | AC | 256 ms | 3396 KB |
01_test_09.txt | AC | 269 ms | 18484 KB |
01_test_10.txt | AC | 233 ms | 3452 KB |
01_test_11.txt | AC | 251 ms | 18556 KB |
01_test_12.txt | AC | 209 ms | 3388 KB |
01_test_13.txt | AC | 234 ms | 18628 KB |
01_test_14.txt | AC | 185 ms | 3420 KB |
01_test_15.txt | AC | 212 ms | 18720 KB |
01_test_16.txt | AC | 160 ms | 3432 KB |
01_test_17.txt | AC | 192 ms | 18444 KB |
01_test_18.txt | AC | 134 ms | 3468 KB |
01_test_19.txt | AC | 179 ms | 18628 KB |
01_test_20.txt | AC | 109 ms | 3496 KB |
01_test_21.txt | AC | 159 ms | 18572 KB |
01_test_22.txt | AC | 82 ms | 3408 KB |
01_test_23.txt | AC | 117 ms | 18708 KB |
01_test_24.txt | AC | 56 ms | 3536 KB |
01_test_25.txt | AC | 100 ms | 18652 KB |
01_test_26.txt | AC | 28 ms | 3616 KB |
01_test_27.txt | AC | 69 ms | 18716 KB |
01_test_28.txt | AC | 160 ms | 3532 KB |
01_test_29.txt | AC | 195 ms | 18568 KB |
01_test_30.txt | AC | 159 ms | 3428 KB |
01_test_31.txt | AC | 190 ms | 18612 KB |
01_test_32.txt | AC | 160 ms | 3396 KB |
01_test_33.txt | AC | 192 ms | 18556 KB |
01_test_34.txt | AC | 195 ms | 18564 KB |
01_test_35.txt | AC | 189 ms | 18660 KB |
01_test_36.txt | AC | 179 ms | 18576 KB |