結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー |
![]() |
提出日時 | 2020-01-15 12:50:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 135 ms / 5,000 ms |
コード長 | 785 bytes |
コンパイル時間 | 1,689 ms |
コンパイル使用メモリ | 168,800 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-02 21:31:02 |
合計ジャッジ時間 | 3,429 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; #define rep(i,n) for(int i=0;i<(int)(n);++i) #define rrep(i,m) for(int i=(int)(m)-1;i>=0;--i) #define debug(x) cout << #x << "=" << (x) << endl; template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;} template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;} template<typename T> void fail(T v){cout << v << endl;exit(0);} //template end void solve(){ int N; cin>>N; vector<int> A(N); rep(i,N) cin >> A[i]; vector<int> res(1<<15); res[0]=1; rep(i,N){ rep(j,1<<15) if(res[j])res[j^A[i]]=1; } int ct=0; rep(i,1<<15)ct+=res[i]; cout<<ct<<endl; } int main(){ cin.tie(0); ios::sync_with_stdio(false); solve(); return 0; }