10362022-02-27 11:34:53Csizmadia MiklósBlokk eliminációcpp14Wrong answer 32/5030ms9996 KiB
#include <iostream>
#include <bits/stdc++.h>

using namespace std;


bool megoldas [5];

string bemen;

vector<bool> jok;


int main()
{
    int t;
    cin>>t;

    for (int i = 0; i <t;i++)
    {
        cin>>bemen;
        for (int j=jok.size()-1;j>-1;j--)
        {
            jok.pop_back();
        }

        int db=1;

        for (int j = 1; j <bemen.size();j++)
        {
            if (bemen[j]==bemen[j-1])
            {
                db++;
            }
            else
            {
                if (db<2)
                {
                    jok.push_back(false);
                }
                else
                {
                    jok.push_back(true);
                }
                db=1;
            }
        }
        if (db==1)
        {
            jok.push_back(false);
        }
        else
        {
            jok.push_back(true);
        }

        if (true)
        {
            int kozep1=0;
            int kozep2=0;
            if (jok.size()%2==1)
            {
                kozep1 = jok.size()/2;
                kozep2 = jok.size()/2;
            }
            else
            {
                kozep1 = jok.size()/2;
                kozep2 = jok.size()/2-1;
            }

            int jobbra = jok.size();
            int balra = -1;

            for (int j=kozep1; j <jok.size();j++)
            {
                if (jok[j]==true)
                {
                    jobbra=j;
                    break;
                }
            }
            for (int j=kozep2; j >-1;j--)
            {
                if (jok[j]==true)
                {
                    balra=j;
                    break;
                }
            }
            int jobbdb=(jok.size()-jobbra)*2-1;
            int baldb=(balra)*2+1;

            if (baldb<0)
            {
                baldb=0;
            }
            if (jobbdb<0)
            {
                jobbdb=0;
            }

            if (jobbdb+baldb>=jok.size())
            {
                megoldas[i]=true;
            }
            else
            {
                megoldas[i]=false;
            }
        }
    }
    for (int i = 0; i <t;i++)
    {
        if (megoldas[i])
        {
            cout<<"IGEN"<<endl;
        }
        else
        {
            cout<<"NEM"<<endl;
        }
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base32/50
1Accepted0/03ms1960 KiB
2Accepted0/029ms3680 KiB
3Accepted2/21ms3080 KiB
4Accepted2/21ms3076 KiB
5Accepted2/21ms3084 KiB
6Wrong answer0/21ms3084 KiB
7Wrong answer0/21ms3096 KiB
8Accepted2/21ms3092 KiB
9Wrong answer0/21ms3100 KiB
10Accepted2/21ms3104 KiB
11Accepted2/22ms3112 KiB
12Wrong answer0/21ms3124 KiB
13Accepted2/21ms3140 KiB
14Accepted2/24ms3320 KiB
15Wrong answer0/34ms3420 KiB
16Accepted3/34ms3524 KiB
17Accepted3/330ms5076 KiB
18Wrong answer0/328ms6064 KiB
19Accepted3/329ms7048 KiB
20Accepted3/328ms8032 KiB
21Wrong answer0/428ms9012 KiB
22Accepted4/429ms9996 KiB