22802023-01-09 12:26:18rennTitkos sorozatcpp11Wrong answer 0/4028ms6396 KiB
#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> pii;

int main()
{
    cin.tie(0);
    iostream::sync_with_stdio(0);
    int n;
    cin >> n;
    
    vector<pii> A;
    vector<int> B;
    int x;
    
    for(int i = 0; i < n; i++){
        cin >> x;
        if(x == -1){
            B.push_back(i);
        }
        else{
            A.push_back({x, i});
        }
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end(), greater<int>());
    
    vector<int> mo(n);
    int akt = 1;
    for(pii x : A){
        mo[x.second] = akt++;
    }
    for(int x : B){
        mo[x] = akt++;
    }
    
    for(int x : mo){
        cout << x << " ";
    }
    cout << "\n";

    
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Accepted0/03ms1828 KiB
2Wrong answer0/014ms3272 KiB
3Wrong answer0/12ms2128 KiB
4Wrong answer0/12ms2260 KiB
5Wrong answer0/22ms2468 KiB
6Wrong answer0/12ms2692 KiB
7Wrong answer0/12ms2856 KiB
8Wrong answer0/22ms2956 KiB
9Wrong answer0/228ms5600 KiB
10Wrong answer0/228ms5588 KiB
11Wrong answer0/228ms5800 KiB
12Wrong answer0/228ms5844 KiB
13Wrong answer0/227ms5912 KiB
14Wrong answer0/227ms5852 KiB
15Wrong answer0/227ms5976 KiB
16Wrong answer0/327ms6136 KiB
17Wrong answer0/327ms6180 KiB
18Wrong answer0/327ms6252 KiB
19Wrong answer0/326ms6240 KiB
20Wrong answer0/326ms6136 KiB
21Wrong answer0/126ms6208 KiB
22Wrong answer0/126ms6396 KiB
23Wrong answer0/126ms6380 KiB