제출 #520401

#제출 시각아이디문제언어결과실행 시간메모리
520401amunduzbaevFootball (info1cup20_football)C++14
100 / 100
45 ms2036 KiB
#include "bits/stdc++.h" using namespace std; #define ar array const int N = 105; int dp[N][N]; void solve(){ int n, k; cin>>n>>k; vector<int> a(n); for(int i=0;i<n;i++) cin>>a[i]; while(k){ int sum = accumulate(a.begin(), a.end(), 0ll); if(sum & 1){ cout<<1; return; } for(auto& x : a) x /= 2; k /= 2; } cout<<0; } signed main(){ ios::sync_with_stdio(0); cin.tie(0); dp[0][0] = 0; for(int i=1;i<N;i++){ for(int j=1;j<=i;j++){ vector<int> tt; for(int l=1;l<=j;l++){ tt.push_back(dp[i-l][min(i-l, l)]); } sort(tt.begin(), tt.end()); int last = 0; for(auto x : tt){ if(x > last) break; if(x == last) last++; } dp[i][j] = last; } } int t; cin>>t; while(t--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...