204152026-01-06 17:57:31algoproBlokk eliminációcpp17Time limit exceeded 6/50400ms948 KiB
// UUID: c8206da4-9f2b-4915-b022-6185305d337d
#include <bits/stdc++.h>
using namespace std;

int main() {
	int t; cin >> t;
	while(t--){
		string a; cin >> a;
		vector<bool> b;
		int w = -1 , v = 0;
		for(char x : a){
			if(w != -1 && x-'0'!=w){
				b.push_back(v-1);
				v=0;
			}
			v++;
			w = x-'0';
		}
		b.push_back(v);
		int n = b.size();
		vector<bool> dp(n+2 , 0);
		dp[0] = 1;
		for(int i = 0; i < n; i++){
			if(!b[i])continue;
			for(int j = n; j >= 0; j--){
				int u = 2*i-j;
				if(dp[j] && u > j && u <= n)dp[u] = 1;
				if(dp[j] && u > j && u+1 <= n)dp[u+1] = 1;
			}
		}
		//for(int i = 0; i < n; i++)cout << b[i] << " ";
		//cout << endl;
		cout << (dp[n]?"IGEN\n":"NEM\n");
	}
}
SubtaskSumTestVerdictTimeMemory
base6/50
1Accepted0/01ms316 KiB
2Time limit exceeded0/0381ms712 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/21ms316 KiB
9Wrong answer0/21ms316 KiB
10Wrong answer0/21ms316 KiB
11Wrong answer0/24ms412 KiB
12Wrong answer0/24ms316 KiB
13Accepted2/27ms316 KiB
14Time limit exceeded0/2328ms452 KiB
15Time limit exceeded0/3340ms316 KiB
16Time limit exceeded0/3400ms448 KiB
17Time limit exceeded0/3384ms892 KiB
18Time limit exceeded0/3382ms756 KiB
19Time limit exceeded0/3398ms652 KiB
20Time limit exceeded0/3388ms708 KiB
21Time limit exceeded0/4379ms948 KiB
22Time limit exceeded0/4379ms708 KiB