結果

問題 No.1876 Xor of Sum
ユーザー ytqm3
提出日時 2022-03-10 14:01:32
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 385 ms / 2,000 ms
コード長 273 bytes
コンパイル時間 2,077 ms
コンパイル使用メモリ 193,600 KB
最終ジャッジ日時 2025-01-28 07:58:05
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin>>N;
  bitset<4000005> dp(1);
  for(int i=0;i<N;++i){
    int t;
    cin>>t;
    dp^=(dp<<t);
  }
  int ans=0;
  for(int i=0;i<=4000000;++i){
    if(dp[i]){
      ans^=i;
    }
  }
  cout<<ans<<endl;
}
0