3102021-09-21 20:21:31Kevinke12Bürokrácia (40)cpp14Wrong answer 0/40368ms6552 KiB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int N, be;
int t[100005][2]; //melyik a kovi; aktive
char c;

int main()
{
    cin >> N;
    for(int i = 1; i <= N; i++)
    {
        cin >> c;
        if(c=='R')
        {
            t[i][0]=0;
            t[i][2]=1;
        }
        else
        {
            cin >> be;
            t[i][0]=be;
            t[i][1]=1;
            do
            {
                t[be][1]=!t[be][1];
                be=t[be][0];
            }while((t[be][0]!=0));
        }
    }

    vector<int> ans;

    for(int i = 1; i <= N; i++)
    {
        //cout << i << ":" << t[i][0] << "-" << t[i][1] << "\n";
        if(t[i][1]) ans.push_back(i);
    }
    cout << ans.size() << "\n";
    for(int a:ans) cout << a << " ";cout << "\n";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Accepted0/03ms1820 KiB
2Wrong answer0/12ms2048 KiB
3Wrong answer0/12ms2212 KiB
4Wrong answer0/13ms2432 KiB
5Wrong answer0/110ms3952 KiB
6Time limit exceeded0/1368ms2476 KiB
7Wrong answer0/150ms4676 KiB
8Wrong answer0/250ms4916 KiB
9Wrong answer0/252ms5084 KiB
10Wrong answer0/254ms5292 KiB
11Wrong answer0/252ms6008 KiB
12Wrong answer0/216ms5512 KiB
13Wrong answer0/216ms5524 KiB
14Wrong answer0/248ms5916 KiB
15Wrong answer0/235ms6140 KiB
16Wrong answer0/216ms5728 KiB
17Wrong answer0/216ms5732 KiB
18Wrong answer0/216ms5984 KiB
19Wrong answer0/29ms5840 KiB
20Wrong answer0/29ms5848 KiB
21Wrong answer0/29ms5940 KiB
22Time limit exceeded0/2356ms6552 KiB
23Time limit exceeded0/4354ms4168 KiB