Submission #520359

#TimeUsernameProblemLanguageResultExecution timeMemory
520359amunduzbaevFootball (info1cup20_football)C++14
26 / 100
25 ms716 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]; int res = 0; if(k == 1){ for(int i=0;i<n;i++){ res ^= (a[i] & 1); } } else { for(int i=0;i<n;i++){ if(k <= a[i]) res ^= dp[a[i]][k, a[i]]; else { res ^= a[i]; } } } if(res) cout<<1; else 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(); } }

Compilation message (stderr)

football.cpp: In function 'void solve()':
football.cpp:21:34: warning: left operand of comma operator has no effect [-Wunused-value]
   21 |    if(k <= a[i]) res ^= dp[a[i]][k, a[i]];
      |                                  ^
#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...