31452023-02-20 11:48:29TuruTamasBlokk eliminációcpp11Runtime error 0/5043ms64848 KiB
#include <bits/stdc++.h>
using namespace std;
bool good = false;
vector<bool> blokkok;

void checkIfGood(int loc) {
    if (loc == blokkok.size()) good = true;
    for (size_t i = loc; i <= (blokkok.size()-loc)/2; i++)
    {
        if (blokkok[i]) checkIfGood(i + i-loc);
    }
    
}

int main() {
    int T;
    cin >> T;
    string line;
    for (int i = 0; i < T; ++i) {
        blokkok.clear();
        cin >> line;
        for (int i = 0; i < line.size(); ++i) {
            if (line[i] == line[i+1]) {
                blokkok.push_back(true);
                char start = line[i];
                for (; line[i] == start && i < line.size(); i++){}
            }
            else {
                blokkok.push_back(false);
            }
        }
        checkIfGood((0));
        if (good) {
            cout << "IGEN\n";
        }
        else {
            cout << "NEM\n";
        }
        good = false;
    }
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/03ms1816 KiB
2Runtime error0/039ms64848 KiB
3Wrong answer0/23ms2128 KiB
4Runtime error0/235ms64540 KiB
5Runtime error0/234ms64304 KiB
6Runtime error0/234ms64292 KiB
7Runtime error0/235ms64096 KiB
8Runtime error0/234ms63908 KiB
9Runtime error0/234ms63916 KiB
10Runtime error0/234ms63864 KiB
11Runtime error0/226ms63792 KiB
12Runtime error0/232ms63784 KiB
13Runtime error0/228ms63540 KiB
14Runtime error0/229ms63304 KiB
15Runtime error0/335ms63060 KiB
16Runtime error0/328ms62804 KiB
17Runtime error0/343ms62620 KiB
18Runtime error0/343ms62404 KiB
19Runtime error0/332ms62192 KiB
20Runtime error0/332ms62192 KiB
21Runtime error0/443ms61972 KiB
22Runtime error0/429ms61972 KiB