結果

問題 No.2658 L-R Nim
ユーザー RubikunRubikun
提出日時 2024-03-01 22:04:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,610 bytes
コンパイル時間 2,085 ms
コンパイル使用メモリ 205,612 KB
実行使用メモリ 20,516 KB
最終ジャッジ日時 2024-03-01 22:06:23
合計ジャッジ時間 50,229 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 5 ms
11,512 KB
testcase_02 WA -
testcase_03 AC 5 ms
11,512 KB
testcase_04 AC 5 ms
11,512 KB
testcase_05 WA -
testcase_06 AC 6 ms
11,640 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 6 ms
11,640 KB
testcase_11 WA -
testcase_12 AC 6 ms
11,640 KB
testcase_13 AC 5 ms
11,640 KB
testcase_14 AC 5 ms
11,640 KB
testcase_15 WA -
testcase_16 AC 6 ms
11,640 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 6 ms
11,640 KB
testcase_20 WA -
testcase_21 AC 6 ms
11,640 KB
testcase_22 AC 5 ms
11,640 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 AC 8 ms
12,076 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 8 ms
12,156 KB
testcase_38 TLE -
testcase_39 TLE -
testcase_40 TLE -
testcase_41 TLE -
testcase_42 TLE -
testcase_43 TLE -
testcase_44 TLE -
testcase_45 TLE -
testcase_46 TLE -
testcase_47 TLE -
testcase_48 WA -
testcase_49 WA -
testcase_50 TLE -
testcase_51 TLE -
testcase_52 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=1<<20,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N,K;cin>>N>>K;
    vector<ll> A(N),rui(N+1);
    for(int i=0;i<N;i++){
        cin>>A[i];
        rui[i+1]=rui[i]^A[i];
    }
    
    ll L=-1,R=N;
    
    vector<ll> la(MAX,-1);
    
    for(ll i=0;i<=N;i++){
        if(la[rui[i]]!=-1){
            chmax(L,la[rui[i]]+1);
            chmin(R,i);
        }
        la[rui[i]]=i;
    }
    
    if(L==-1){
        cout<<"Yes\n";
        return 0;
    }
    
    if(L>R){
        cout<<"No\n";
        return 0;
    }
    
    vector<ll> cn(MAX);
    for(ll i=0;i<L;i++){
        for(ll j=L;j<=N;j++){
            cn[rui[i]^rui[j]]++;
        }
    }
    
    cout<<L<<" "<<R<<endl;
    
    for(ll s=L;s<=R;s++){
        for(ll x=max(1LL,A[s-1]-K);x<=A[s-1]+K;x++){
            ll z=A[s-1]^x;
            if(cn[z]==0){
                //cout<<s<<" "<<x<<" "<<z<<endl;
                cout<<"Yes\n";
                return 0;
            }
        }
        
        for(ll i=0;i<s;i++) cn[rui[i]^rui[s]]--;
        for(ll i=s+1;i<=N;i++) cn[rui[i]^rui[s]]++;
    }
    
    cout<<"No\n";
}

0