제출 #525410

#제출 시각아이디문제언어결과실행 시간메모리
525410dron_rpFootball (info1cup20_football)C++14
26 / 100
2095 ms66156 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ int t; cin >> t; while (t--){ int n, k, x; cin >> n >> k; if (k == 1){ ll sum = 0; for (int i = 0; i<n; i++){ cin >> x; sum += x; } cout << (sum%2 == 0 ? "0" : "1"); } else if (n == 1){ cin >> n; if (k>=n){ if (n%2 == 0) cout << "1"; } else{ //cout << "here\n"; vector<bool> dp; bool good = false; if (n%2 != 0){ cout << "1"; continue; } for (int i = 2; i<=k; i++){ dp.assign(n+1, true); //cout << "i= " << i << "\n"; for (int j = n-1; j>=1;j-=(i+1)){ //cout << j << "\n"; dp[j] = false; } //cout << "----------\n"; if (dp[1]){ good = true; break; } } cout << good; } } else{ cout << "0"; } } }
#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...