72812024-01-05 21:39:32anonTitkos sorozatcpp17Wrong answer 0/4023ms6476 KiB
#include <bits/stdc++.h>
#define FastIO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
typedef long long ll;
int main() {
    FastIO;
    ll i, lo, hi, N;
    cin >> N;
    vector<ll> B(N);
    for(i = 0; i < N; i++)
        cin >> B[i];
    lo = 0;
    hi = N + 1;
    vector<ll> todo(N, -1);
    for(i = 0; i < N; i++) {
        if(todo[i] != -1)
            lo = todo[i];
        if(B[i] == -1)
            cout << --hi << ' ';
        else
            cout << (todo[B[i] - 1] = lo + B[i] - i - 1) << ' ';
    }
    cout << '\n';
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Accepted0/03ms1824 KiB
2Wrong answer0/013ms3548 KiB
3Wrong answer0/13ms2236 KiB
4Wrong answer0/13ms2448 KiB
5Wrong answer0/23ms2528 KiB
6Wrong answer0/13ms2552 KiB
7Wrong answer0/13ms2808 KiB
8Wrong answer0/23ms2764 KiB
9Wrong answer0/223ms5932 KiB
10Wrong answer0/223ms6208 KiB
11Wrong answer0/223ms6148 KiB
12Wrong answer0/223ms6152 KiB
13Wrong answer0/223ms6160 KiB
14Wrong answer0/221ms6180 KiB
15Wrong answer0/221ms6148 KiB
16Wrong answer0/321ms6156 KiB
17Wrong answer0/321ms6156 KiB
18Wrong answer0/323ms6384 KiB
19Wrong answer0/321ms6476 KiB
20Wrong answer0/323ms6460 KiB
21Wrong answer0/123ms6468 KiB
22Wrong answer0/123ms6464 KiB
23Wrong answer0/123ms6464 KiB