Submission #64283781


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pint pair<int, int>
#define vint vector<int>
#define IO                        \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define umap unordered_map<int, int>
#define all(v) v.begin(), v.end()
#define pmax priority_queue<int>
#define pmin priority_queue<int, vint, greater<int>>
#define newl cout << "\n"

int inf = LONG_MAX, mod = 1000000007;

void run()
{
    int n, i, t=1;
    cin >> n;
    int a[n], b[n];
    for (i = 0; i < n;i++) {
        cin >> a[i];
        b[i] = a[i];
    }
    sort(b,b+n,greater<int>());
    unordered_map<int, int> m;
    for(auto i:b) {
        if(!m[i])
            m[i] = t;
        t++;
    }
    for (int i = 0; i < n;i++) {
        cout << m[a[i]] << "\n";
    }
}

signed main()
{
    IO;
    int test;
    // for (cin >> test; test; test -= 1, cout << "\n")
        run();
}

Submission Info

Submission Time
Task B - Ranking with Ties
User naveen_0503
Language C++ 20 (gcc 12.2)
Score 200
Code Size 984 Byte
Status AC
Exec Time 1 ms
Memory 3636 KiB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:43:9: warning: unused variable ‘test’ [-Wunused-variable]
   43 |     int test;
      |         ^~~~

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 3480 KiB
00_sample_01.txt AC 1 ms 3496 KiB
00_sample_02.txt AC 1 ms 3436 KiB
00_sample_03.txt AC 1 ms 3424 KiB
01_random_00.txt AC 1 ms 3636 KiB
01_random_01.txt AC 1 ms 3448 KiB
01_random_02.txt AC 1 ms 3560 KiB
01_random_03.txt AC 1 ms 3572 KiB
02_random2_00.txt AC 1 ms 3568 KiB
02_random2_01.txt AC 1 ms 3504 KiB
02_random2_02.txt AC 1 ms 3436 KiB
02_random2_03.txt AC 1 ms 3492 KiB
02_random2_04.txt AC 1 ms 3504 KiB
02_random2_05.txt AC 1 ms 3492 KiB
02_random2_06.txt AC 1 ms 3416 KiB
02_random2_07.txt AC 1 ms 3364 KiB
02_random2_08.txt AC 1 ms 3604 KiB
03_sorted_00.txt AC 1 ms 3424 KiB
03_sorted_01.txt AC 1 ms 3464 KiB
04_handmade_00.txt AC 1 ms 3428 KiB
04_handmade_01.txt AC 1 ms 3360 KiB