結果
問題 |
No.1091 Range Xor Query
|
ユーザー |
|
提出日時 | 2020-08-01 07:36:10 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 72 ms / 2,000 ms |
コード長 | 470 bytes |
コンパイル時間 | 635 ms |
コンパイル使用メモリ | 71,716 KB |
最終ジャッジ日時 | 2025-01-12 12:14:22 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 27 |
ソースコード
#include <iostream> #include <vector> void solve() { int n, q; std::cin >> n >> q; std::vector<int> xs(n + 1, 0); for (int i = 0; i < n; ++i) { int x; std::cin >> x; xs[i + 1] = xs[i] ^ x; } while (q--) { int l, r; std::cin >> l >> r; std::cout << (xs[l - 1] ^ xs[r]) << "\n"; } } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }