Submission #692193

#TimeUsernameProblemLanguageResultExecution timeMemory
692193NeroZeinFootball (info1cup20_football)C++14
0 / 100
2082 ms1048576 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;
 
#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif
 
const int N = 100005; 
int n, k;
int a[N]; 
 
int bt(int i, int la) {
	if (i == n) {
		return 0;
	}
	if (a[i] == 0) {
		return bt(i+1, la); 
	}
	bool ret = 0; 
	for (int j = 1; j <= min(la, a[i]); ++j) {
		a[i] -= j;
		ret |= (bt(i, j) == 0);
		a[i] += j; 
	}
	return ret; 
}
 
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t;
	cin >> t;
	while(t--) {
		cin >> n >> k;
		int sum = 0; 
		int twos = 0; 
		for (int i = 0; i < n; ++i) {
			cin >> a[i];
			sum += a[i];
			twos += a[i] / 2; 
		}
			cout << bt(0, k);
		
	}
	return 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...