結果
| 問題 |
No.1456 Range Xor
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-01 10:24:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 62 ms / 2,000 ms |
| コード長 | 539 bytes |
| コンパイル時間 | 1,239 ms |
| コンパイル使用メモリ | 72,488 KB |
| 実行使用メモリ | 7,952 KB |
| 最終ジャッジ日時 | 2025-02-01 10:24:48 |
| 合計ジャッジ時間 | 5,180 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:14:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%d%d",&n,&k);
| ~~~~~^~~~~~~~~~~~~~
main.cpp:19:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
19 | scanf("%d",&j);
| ~~~~~^~~~~~~~~
ソースコード
#include<iostream>
#include<vector>
#include<set>
#include<cassert>
#define rep(i,n) for(i=0;i<(int)(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int n,k;
int main(){
int i,j;
scanf("%d%d",&n,&k);
vector<int> sum(n+1,0);
set<int> v;
v.insert(sum[0]);
rep(i,n){
scanf("%d",&j);
sum[i+1]=sum[i]^j;
if(v.find(k^sum[i+1])!=v.end()){
puts("Yes");
return 0;
}
v.insert(sum[i+1]);
}
puts("No");
return 0;
}