結果
問題 | No.1456 Range Xor |
ユーザー |
![]() |
提出日時 | 2021-03-31 22:08:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 68 ms / 2,000 ms |
コード長 | 2,787 bytes |
コンパイル時間 | 1,514 ms |
コンパイル使用メモリ | 177,096 KB |
実行使用メモリ | 8,064 KB |
最終ジャッジ日時 | 2024-12-15 19:06:43 |
合計ジャッジ時間 | 4,416 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define ll long long#define forin(in ,n) for(ll i=0; i<n; i++) cin>>in[i]#define forout(out) for(ll i=0; i<(ll)out.size(); i++) cout<<out[i]<<endl#define rep(i, n) for (ll i = 0; i < n; ++i)#define rep_up(i, a, n) for (ll i = a; i < n; ++i)#define rep_down(i, a, n) for (ll i = a; i >= n; --i)#define P pair<ll, ll>#define all(v) v.begin(), v.end()#define fi first#define se second#define vvvll vector<vector<vector<ll>>>#define vvll vector<vector<ll>>#define vll vector<ll>#define pqll priority_queue<ll>#define pqllg priority_queue<ll, vector<ll>, greater<ll>>constexpr ll INF = (1ll << 60);//constexpr ll mod = 1000000007;constexpr ll mod = 998244353;constexpr double pi = 3.14159265358979323846;template <typename T>inline bool chmax(T &a, T b) {if (a < b) {a = b;return 1;}return 0;}template <typename T>inline bool chmin(T &a, T b) {if (a > b) {a = b;return 1;}return 0;}template <typename T>void pt(T val) {cout << val << "\n";}template <typename T>void pt_vll(vector<T> &v) {ll vs = v.size();rep(i, vs) {cout << v[i];if (i == vs - 1)cout << "\n";elsecout << " ";}}ll mypow(ll a, ll n) {ll ret = 1;if(n==0) return 1;if(a==0) return 0;rep(i, n) {if (ret > (ll)(1e18 + 10) / a) return -1;ret *= a;}return ret;}long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}ll digsum(ll n) {ll res = 0;while(n > 0) {res += n%10;n /= 10;}return res;}int main() {ll n,m,x=0,y,k,t,s,cnt,flag=0,ans=-INF;cin>>n>>k;vll a(n);vector<P> L(n+1);vector<P> R(n+1);rep(i,n){cin>>a[i];x^=a[i];}rep(i,n){L[i+1].fi=L[i].fi^a[i];L[i+1].se=i+1;}rep(i,n){R[i+1].fi=R[i].fi^a[n-i-1];R[i+1].se=i+1;}sort(all(R));vll r(n+1);rep(i,n+1){r[i]=R[i].fi;}rep(i,n+1){y=L[i].fi^x^k;t=lower_bound(all(r),y)-r.begin();s=upper_bound(all(r),y)-r.begin();while(t<s){if(L[i].se+R[t].se<n){flag=1;}t++;}}if(flag==1) cout<<"Yes"<<endl;else cout<<"No"<<endl;}