18192022-12-04 09:02:54sztomiBürokrácia (40)cpp17Wrong answer 0/4014ms6364 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);


    int n;
    cin >> n;
    vector<int> kov(n+1, -1);
    vector<int> be(n+1, 0);
    char tipus;
    int torol;
    for(int i = 1; i <= n; i++){
        cin >> tipus;
        if(tipus == 'V'){
            cin >> torol;
            kov[i] = torol;
            be[torol]++;
        }
    }

    vector<bool> aktiv(n+1, true);
    queue<int> q;
    for(int i = 1; i <= n; i++){
        if(be[i] == 0){
            q.push(i);
        }
    }
    cout << "0\n";
    return 0;
    int akt;
    while(!q.empty()){
        akt = q.front();
        q.pop();

        int x = kov[akt];
        if(x != -1){
            if(aktiv[akt]){
                aktiv[x] = false;
            }
            be[x]--;
            if(be[x] == 0){
                q.push(x);
            }
        }
    }
    vector<int> ki;
    for(int i = 1; i <= n; i++){
        if(aktiv[i]){
            ki.push_back(i);
        }
    }
    cout << ki.size() << "\n";
    for(int x : ki){
        cout << x << " ";
    }
    cout << "\n";
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Wrong answer0/03ms1832 KiB
2Wrong answer0/12ms2020 KiB
3Wrong answer0/12ms2228 KiB
4Wrong answer0/12ms2440 KiB
5Wrong answer0/14ms4788 KiB
6Wrong answer0/114ms3984 KiB
7Wrong answer0/114ms4176 KiB
8Wrong answer0/214ms4828 KiB
9Wrong answer0/214ms5044 KiB
10Wrong answer0/214ms5060 KiB
11Wrong answer0/214ms5200 KiB
12Wrong answer0/26ms5852 KiB
13Wrong answer0/26ms5972 KiB
14Wrong answer0/214ms5680 KiB
15Wrong answer0/210ms5568 KiB
16Wrong answer0/26ms6068 KiB
17Wrong answer0/26ms6364 KiB
18Wrong answer0/26ms6208 KiB
19Wrong answer0/24ms6272 KiB
20Wrong answer0/24ms6248 KiB
21Wrong answer0/24ms6276 KiB
22Wrong answer0/214ms5340 KiB
23Wrong answer0/414ms5796 KiB