7312021-12-21 15:27:14kismartongBürokrácia (40)python3Wrong answer 8/40170ms24784 KiB
from sys import stdin, stdout

def main():
    n = int(stdin.readline())
    torv = [None] * n
    vInd = [None] * n
    for i in range(n):
        be = stdin.readline()
        if "R" in be:
            torv[i] = "R"
        else:
            be = be.split()
            torv[i] = "V"
            vInd[i] = int(be[1])
    akt = [None] * n
    for i in range(n):
        if torv[i] == "R":
            akt[i] = 1
        else:
            akt[i] = 1
            akt[vInd[i]-1] = 0
            if torv[vInd[i]-1] == "V":
                akt[vInd[vInd[i]-1]-1] = 1
    stdout.writelines(str(akt.count(1)) + "\n")
    for i in range(n):
        if akt[i] == 1:
            stdout.write(str(i+1) + " ")

main()
SubtaskSumTestVerdictTimeMemory
base8/40
1Accepted0/018ms11208 KiB
2Accepted1/117ms11488 KiB
3Wrong answer0/117ms11744 KiB
4Wrong answer0/117ms11756 KiB
5Accepted1/196ms16736 KiB
6Wrong answer0/1168ms23480 KiB
7Wrong answer0/1158ms23040 KiB
8Wrong answer0/2156ms23360 KiB
9Wrong answer0/2156ms23064 KiB
10Wrong answer0/2156ms23376 KiB
11Wrong answer0/2158ms23216 KiB
12Wrong answer0/2101ms18036 KiB
13Wrong answer0/2100ms18428 KiB
14Wrong answer0/2152ms22848 KiB
15Wrong answer0/2129ms21228 KiB
16Wrong answer0/2101ms18588 KiB
17Wrong answer0/2101ms18640 KiB
18Wrong answer0/2101ms18684 KiB
19Accepted2/297ms18096 KiB
20Accepted2/296ms18156 KiB
21Accepted2/296ms18384 KiB
22Wrong answer0/2170ms24684 KiB
23Wrong answer0/4163ms24784 KiB