結果
| 問題 |
No.3205 Range Pairwise Xor Query
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-18 22:02:33 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 561 bytes |
| コンパイル時間 | 3,636 ms |
| コンパイル使用メモリ | 277,092 KB |
| 実行使用メモリ | 11,936 KB |
| 最終ジャッジ日時 | 2025-07-18 22:02:41 |
| 合計ジャッジ時間 | 7,207 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 TLE * 1 -- * 14 |
ソースコード
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n,q;cin>>n>>q;
vector<int>a(n);
for(int i=0;i<n;i++)cin>>a[i];
while(q--){
int l,r;cin>>l>>r;
l--;r--;
int ans=0;
for(int bit=0;bit<30;bit++){
int zero=0,one=0;
for(int i=l;i<=r;i++){
if(a[i]&(1<<bit))one++;
else zero++;
}
ans+=(1LL<<bit)*zero*one;
}
cout<<ans<<endl;
}
}