提出 #64315310


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
#define fs first
#define sd second
#define int long long
const int mod = 1e9 + 7;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<pair<int, int>> a;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a.push_back({x, i});
    }
    sort(a.rbegin(), a.rend());
    int c = 0;
    int r = 1;
    vector<int> rank(n, 1);
    for (int i = 0; i < n - 1; i++)
    {
        rank[a[i].second] = r;
        c++;
        if (a[i].first != a[i + 1].first)
        {
            r += c;
            c = 0;
        }
    }
    rank[a[n - 1].second] = r;

    for (auto i : rank)
        cout << i << endl;
    return 0;
}

提出情報

提出日時
問題 B - Ranking with Ties
ユーザ yashr29
言語 C++ 20 (gcc 12.2)
得点 200
コード長 786 Byte
結果 AC
実行時間 1 ms
メモリ 3612 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 4
AC × 21
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3472 KiB
00_sample_01.txt AC 1 ms 3412 KiB
00_sample_02.txt AC 1 ms 3468 KiB
00_sample_03.txt AC 1 ms 3480 KiB
01_random_00.txt AC 1 ms 3512 KiB
01_random_01.txt AC 1 ms 3396 KiB
01_random_02.txt AC 1 ms 3460 KiB
01_random_03.txt AC 1 ms 3608 KiB
02_random2_00.txt AC 1 ms 3472 KiB
02_random2_01.txt AC 1 ms 3612 KiB
02_random2_02.txt AC 1 ms 3340 KiB
02_random2_03.txt AC 1 ms 3472 KiB
02_random2_04.txt AC 1 ms 3400 KiB
02_random2_05.txt AC 1 ms 3424 KiB
02_random2_06.txt AC 1 ms 3488 KiB
02_random2_07.txt AC 1 ms 3456 KiB
02_random2_08.txt AC 1 ms 3428 KiB
03_sorted_00.txt AC 1 ms 3428 KiB
03_sorted_01.txt AC 1 ms 3484 KiB
04_handmade_00.txt AC 1 ms 3464 KiB
04_handmade_01.txt AC 1 ms 3432 KiB