結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー shoshoshoshoshosho
提出日時 2020-02-17 00:13:04
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 228 ms / 5,000 ms
コード長 931 bytes
コンパイル時間 1,421 ms
コンパイル使用メモリ 164,660 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-15 22:29:14
合計ジャッジ時間 3,716 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 163 ms
4,380 KB
testcase_08 AC 162 ms
4,376 KB
testcase_09 AC 112 ms
4,380 KB
testcase_10 AC 135 ms
4,376 KB
testcase_11 AC 176 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 228 ms
4,376 KB
testcase_15 AC 182 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 42 ms
4,376 KB
testcase_18 AC 158 ms
4,376 KB
testcase_19 AC 22 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;

int main(){

  ll n;cin>>n;
  ll a[n];rep(i,0,n)cin>>a[i];

  bool dp[40000];CLR(dp,false);
  dp[0]=true;
  rep(i,0,n)dp[a[i]]=true;
  rep(i,0,n){
    repr(j,40000,a[i])if(dp[j-a[i]])dp[(j-a[i])^a[i]]=true;
  }
  ll ans=0;
  rep(i,0,40000)if(dp[i])ans++;
  out(ans);

  return 0;
}
0