12982022-04-08 12:09:58rmlanBlokk eliminációcpp14Runtime error 2/5017ms5548 KiB
#include<bits/stdc++.h>
using namespace std;

int main(){
    int t;
    string n;
    cin >> t;
    while(t--){
        cin >> n;
        deque<int> a;
        deque<bool> b;
        b.push_back(n[0]-'0');
        a.push_back(1);
        for(int i = 1; i < n.length(); i++){
            if(n[i]-'0'==b.back()){
                a.back()++;
            }else{
                if(a.back() > 1){
                    a.pop_back();
                    b.pop_back();
                    a.back()++;
                }else{
                    a.push_back(1);
                    b.push_back(n[i]-'0');
                }

            }
        }

        bool j=1;
        while(!a.empty()){
            if(a.back()>1){
                a.pop_back();
                continue;
            }
            if(a.back() == 1){
                j = 0;
                break;
            }
        }
        cout << (j?"IGEN\n":"NEM\n");
    }
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Accepted0/02ms1740 KiB
2Runtime error0/06ms2844 KiB
3Accepted2/21ms2212 KiB
4Runtime error0/21ms2196 KiB
5Runtime error0/21ms1992 KiB
6Runtime error0/21ms2004 KiB
7Runtime error0/22ms2028 KiB
8Runtime error0/21ms2024 KiB
9Runtime error0/21ms2016 KiB
10Runtime error0/21ms2012 KiB
11Runtime error0/22ms2076 KiB
12Runtime error0/21ms2060 KiB
13Runtime error0/21ms2052 KiB
14Runtime error0/22ms2260 KiB
15Runtime error0/32ms2296 KiB
16Runtime error0/32ms2400 KiB
17Runtime error0/317ms4636 KiB
18Runtime error0/310ms4236 KiB
19Runtime error0/36ms4524 KiB
20Runtime error0/36ms4936 KiB
21Runtime error0/46ms5344 KiB
22Runtime error0/46ms5548 KiB