22342023-01-04 15:55:001478Bürokrácia (40)cpp11Elfogadva 40/4048ms5840 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> p32;
typedef pair<ll, ll> p64;
typedef pair<double, double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int>> vv32;
typedef vector<vector<ll>> vv64;
typedef vector<vector<p64>> vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
double eps = 1e-12;
#define forn(i, e) for (ll i = 0; i < e; i++)
#define forsn(i, s, e) for (ll i = s; i < e; i++)
#define rforn(i, s) for (ll i = s; i >= 0; i--)
#define rforsn(i, s, e) for (ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout << #x << " = " << x << ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 2e18
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())

int main()
{
    //ifstream cin("be.txt");
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++)
    {
        char c;
        cin >> c;
        if (c == 'V')
        {
            cin >> a[i];
        }
    }

    vector<int> active(n + 1, 1);
    int ans = 0;

    for (int i = n; i >= 1; i--)
    {
        if (active[i])
        {
            ans++;
            active[a[i]] = 0;
        }
    }

    cout << ans << '\n';
    for (int i = 1; i <= n; i++)
    {
        if(active[i]){
            cout << i << " ";      
        }
    }

    return 0;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base40/40
1Elfogadva0/03ms1812 KiB
2Elfogadva1/12ms1908 KiB
3Elfogadva1/12ms2104 KiB
4Elfogadva1/13ms2464 KiB
5Elfogadva1/121ms4152 KiB
6Elfogadva1/148ms4204 KiB
7Elfogadva1/146ms4440 KiB
8Elfogadva2/246ms4620 KiB
9Elfogadva2/246ms4684 KiB
10Elfogadva2/246ms4812 KiB
11Elfogadva2/246ms4896 KiB
12Elfogadva2/224ms4972 KiB
13Elfogadva2/224ms4968 KiB
14Elfogadva2/243ms5224 KiB
15Elfogadva2/235ms5452 KiB
16Elfogadva2/224ms5388 KiB
17Elfogadva2/224ms5536 KiB
18Elfogadva2/224ms5568 KiB
19Elfogadva2/221ms5764 KiB
20Elfogadva2/221ms5840 KiB
21Elfogadva2/221ms5732 KiB
22Elfogadva2/248ms5728 KiB
23Elfogadva4/448ms5728 KiB