Submission #64321868


Source Code Expand

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#ifdef LOCAL
#include "debugging_jinish.h"
#else
#define dbg(...) 1
#endif
 
template <typename num_t>
using ordered_set = tree<num_t, null_type, less<num_t>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll long long
#define ld long double

void solve(){

    int n; cin >> n;
    int ar[n],copy[n];
    map<int,int> mp,mp2;
    for(int i=0; i<n; i++){
        cin >> ar[i];
        copy[i] = ar[i];
        mp[ar[i]]++;
    }
    int r = 1;
    sort(copy,copy+n);
    set<int> s;
    for(int i=n-1; ~i; i--){
        if(s.count(copy[i])) continue;
        mp2[copy[i]] = r;
        r += mp[copy[i]];
        s.insert(copy[i]);
    }

    for(int i=0; i<n; i++){
        cout << mp2[ar[i]] << "\n";
    }
}

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  
       solve();

  return 0;
}

Submission Info

Submission Time
Task B - Ranking with Ties
User JyuK_SIR
Language C++ 20 (gcc 12.2)
Score 200
Code Size 1035 Byte
Status AC
Exec Time 2 ms
Memory 3624 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 21
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 03_sorted_00.txt, 03_sorted_01.txt, 04_handmade_00.txt, 04_handmade_01.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3496 KiB
00_sample_01.txt AC 1 ms 3404 KiB
00_sample_02.txt AC 1 ms 3352 KiB
00_sample_03.txt AC 1 ms 3560 KiB
01_random_00.txt AC 1 ms 3496 KiB
01_random_01.txt AC 1 ms 3436 KiB
01_random_02.txt AC 1 ms 3436 KiB
01_random_03.txt AC 1 ms 3432 KiB
02_random2_00.txt AC 1 ms 3472 KiB
02_random2_01.txt AC 2 ms 3560 KiB
02_random2_02.txt AC 1 ms 3624 KiB
02_random2_03.txt AC 1 ms 3564 KiB
02_random2_04.txt AC 1 ms 3492 KiB
02_random2_05.txt AC 1 ms 3488 KiB
02_random2_06.txt AC 1 ms 3440 KiB
02_random2_07.txt AC 1 ms 3472 KiB
02_random2_08.txt AC 1 ms 3504 KiB
03_sorted_00.txt AC 1 ms 3568 KiB
03_sorted_01.txt AC 1 ms 3496 KiB
04_handmade_00.txt AC 1 ms 3388 KiB
04_handmade_01.txt AC 1 ms 3616 KiB