結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー glretoglreto
提出日時 2020-11-13 20:29:16
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 226 ms / 5,000 ms
コード長 866 bytes
コンパイル時間 1,498 ms
コンパイル使用メモリ 167,668 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-30 02:26:42
合計ジャッジ時間 3,980 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 195 ms
4,380 KB
testcase_08 AC 202 ms
4,376 KB
testcase_09 AC 137 ms
4,380 KB
testcase_10 AC 165 ms
4,380 KB
testcase_11 AC 217 ms
4,376 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 225 ms
4,380 KB
testcase_15 AC 226 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 51 ms
4,376 KB
testcase_18 AC 193 ms
4,380 KB
testcase_19 AC 26 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits//stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
#define rrep(i,n) for(ll i = n-1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
#define RALL(a) rbegin(a),rend(a)
typedef long long int ll;
typedef long double ld;
const int MAX = 510000;
const ll MOD = 1000000007;
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; }
const ll INF = 1e18;
int main(){
    int n;cin >>n;
    vector<int> a(n);vector<int> dp(2e5,0);
    dp[0] = 1;
    rep(i,n) cin >>a[i];
    rep(i,n){
        rep(j,1<<15){
            chmax(dp[j^a[i]],dp[j]);
        }
    }int cnt = 0;
    rep(i,1<<15) if(dp[i])cnt++;
    cout << cnt << endl;
}
0