23882023-01-12 12:47:07sztomiTitkos sorozatcpp11Wrong answer 0/4028ms6852 KiB
#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> pii;

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

    int n;
    cin >> n;
    vector<int> neg;
    vector<pii> tobbi;
    int a;
    for(int i = 1; i <= n; i++){
        cin >> a;
        if(a == -1){
            neg.push_back(i);
        }
        else{
            tobbi.push_back({a, i});
        }
    }
    sort(neg.begin(), neg.end(), greater<int>());
    sort(tobbi.begin(), tobbi.end());
    vector<int> megoldas(n+1, -1);
    int akt = 1;
    for(auto x : tobbi){
        megoldas[x.second] = akt++;
    }
    for(int x : neg){
        megoldas[x] = akt++;
    }
    for(int i = 1; i <= n; i++){
        cout << megoldas[i] << " ";
    }
    cout << "\n";
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Accepted0/03ms1836 KiB
2Wrong answer0/014ms3224 KiB
3Wrong answer0/12ms2160 KiB
4Wrong answer0/12ms2392 KiB
5Wrong answer0/22ms2568 KiB
6Wrong answer0/12ms2796 KiB
7Wrong answer0/12ms2876 KiB
8Wrong answer0/22ms3136 KiB
9Wrong answer0/228ms5688 KiB
10Wrong answer0/227ms5752 KiB
11Wrong answer0/227ms5792 KiB
12Wrong answer0/226ms5996 KiB
13Wrong answer0/226ms6204 KiB
14Wrong answer0/227ms6264 KiB
15Wrong answer0/226ms6476 KiB
16Wrong answer0/325ms6512 KiB
17Wrong answer0/325ms6780 KiB
18Wrong answer0/326ms6740 KiB
19Wrong answer0/325ms6712 KiB
20Wrong answer0/324ms6720 KiB
21Wrong answer0/125ms6784 KiB
22Wrong answer0/125ms6796 KiB
23Wrong answer0/125ms6852 KiB