結果
| 問題 | 
                            No.1493 隣接xor
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-04-30 22:14:06 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 507 bytes | 
| コンパイル時間 | 2,142 ms | 
| コンパイル使用メモリ | 200,024 KB | 
| 最終ジャッジ日時 | 2025-01-21 03:12:51 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 3 | 
| other | AC * 3 WA * 24 | 
ソースコード
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1000000007;
int N,A[1<<20];
signed main(){
    cin>>N;
    for(int i=0;i<N;i++) cin>>A[i];
    for(int i=0;i<N-1;i++) if(A[i]) goto home;
    cout<<N<<endl; return 0;
    home:;
    map<int,int>mp;
    int n=A[0],ans=1; cin>>n;
    for(int i=1;i<N;i++){
        int b=ans;
        (ans*=2)%=mod;
        (ans+=mod-mp[n])%=mod;
        (mp[n]+=b)%=mod;
        n^=A[i];
        cout<<ans<<endl;
    }
    cout<<ans<<endl;
}