結果
| 問題 |
No.1456 Range Xor
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-03-31 21:59:08 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 148 ms / 2,000 ms |
| コード長 | 409 bytes |
| コンパイル時間 | 2,987 ms |
| コンパイル使用メモリ | 197,860 KB |
| 最終ジャッジ日時 | 2025-01-20 03:26:58 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d%d",&N,&K);
| ~~~~~^~~~~~~~~~~~~~
main.cpp:13:25: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | rep(i,N){ int a; scanf("%d",&a); A[i+1]=A[i]^a; }
| ~~~~~^~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
int N,K;
vector<int> A;
int main(){
scanf("%d%d",&N,&K);
A.resize(N+1);
rep(i,N){ int a; scanf("%d",&a); A[i+1]=A[i]^a; }
set<int> S;
rep(i,N){
S.insert(A[i]);
if(S.count(A[i+1]^K)!=0){ printf("Yes\n"); return 0; }
}
printf("No\n");
return 0;
}
Nachia