結果
問題 | No.2195 AND Set |
ユーザー | 蜜蜂 |
提出日時 | 2023-01-20 21:42:57 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 433 ms / 2,000 ms |
コード長 | 1,446 bytes |
コンパイル時間 | 1,917 ms |
コンパイル使用メモリ | 172,224 KB |
実行使用メモリ | 13,696 KB |
最終ジャッジ日時 | 2023-09-05 13:56:50 |
合計ジャッジ時間 | 7,144 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 197 ms
5,480 KB |
testcase_03 | AC | 219 ms
5,676 KB |
testcase_04 | AC | 194 ms
5,652 KB |
testcase_05 | AC | 301 ms
6,888 KB |
testcase_06 | AC | 296 ms
6,920 KB |
testcase_07 | AC | 277 ms
6,684 KB |
testcase_08 | AC | 303 ms
6,892 KB |
testcase_09 | AC | 255 ms
6,676 KB |
testcase_10 | AC | 433 ms
13,528 KB |
testcase_11 | AC | 428 ms
13,516 KB |
testcase_12 | AC | 422 ms
13,544 KB |
testcase_13 | AC | 421 ms
13,516 KB |
testcase_14 | AC | 433 ms
13,696 KB |
ソースコード
//g++ 1.cpp -std=c++17 -O2 -I . #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vi = vector<int>; using vvi = vector<vi>; using vll = vector<ll>; using vvll = vector<vll>; using vld = vector<ld>; using vvld = vector<vld>; using vst = vector<string>; using vvst = vector<vst>; #define fi first #define se second #define pb push_back #define eb emplace_back #define pq_big(T) priority_queue<T,vector<T>,less<T>> #define pq_small(T) priority_queue<T,vector<T>,greater<T>> #define all(a) a.begin(),a.end() #define rep(i,start,end) for(ll i=start;i<(ll)(end);i++) #define per(i,start,end) for(ll i=start;i>=(ll)(end);i--) #define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end()) int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int q; cin>>q; map<int,int> mp; int sz=0; vi bt(30,0); while(q--){ int op;cin>>op; if(op==1){ int x;cin>>x; if(mp[x]==1)continue; mp[x]++; sz++; rep(i,0,30){ if(x&(1<<i))bt[i]++; } } else if(op==2){ int x;cin>>x; if(mp[x]==0)continue; mp[x]--; sz--; rep(i,0,30){ if(x&(1<<i))bt[i]--; } } else{ int ans=0; rep(i,0,30){ if(bt[i]==sz){ ans+=(1<<i); } } if(sz==0)ans=-1; cout<<ans<<endl; } } }