64112023-11-28 10:12:01BenedekMartonBürokrácia (40)cpp14Accepted 40/4050ms5044 KiB
#include <iostream>

using namespace std;

int main()
{
    int n, x;
    cin >> n;
    int ren[n+1];
    char rv;
    x=n;
    for(int i=1; i<=n; i++)
    {
        cin >> rv;
        if(rv=='R')
        {
            ren[i]=0;
        }
        else
        {
            cin >> ren[i];
        }
    }
    for(int i=n; i>=1; i--)
    {
        if(ren[i]!=-1)
        {
            ren[ren[i]]=-1;
        }
        else
        {
            x--;
        }
        //cout << ren[i] << " ";
    }
    //cout << endl;
    cout << x << endl;
    for(int i=1; i<=n; i++)
    {
        if(ren[i]!=-1)
        {
            cout << i << " ";
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1908 KiB
2Accepted1/13ms2312 KiB
3Accepted1/13ms2404 KiB
4Accepted1/13ms2544 KiB
5Accepted1/121ms3648 KiB
6Accepted1/148ms4088 KiB
7Accepted1/146ms3988 KiB
8Accepted2/246ms4208 KiB
9Accepted2/248ms4284 KiB
10Accepted2/246ms4176 KiB
11Accepted2/246ms4168 KiB
12Accepted2/225ms4400 KiB
13Accepted2/225ms4624 KiB
14Accepted2/243ms4628 KiB
15Accepted2/235ms4472 KiB
16Accepted2/225ms4472 KiB
17Accepted2/225ms4668 KiB
18Accepted2/225ms4880 KiB
19Accepted2/221ms4960 KiB
20Accepted2/223ms4876 KiB
21Accepted2/221ms4872 KiB
22Accepted2/248ms4940 KiB
23Accepted4/450ms5044 KiB