提出 #64282287


ソースコード 拡げる

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ull unsigned long long
#define ld long double
#define int long long
#define nl "\n"
#define oo 1e9 + 1
#define OO 1e18 + 1
#define sp ' '
#define sz(x) (int)(x.size())
#define MOD 1000000007
#define fixed(n) fixed << setprecision(n)
#define sub_mod(a, b, m) ((((a) % m) - ((b) % m) + m) % m)
#define add_mod(a, b, m) ((((a) % m) + ((b) % m)) % m)
#define mult_mod(a, b, m) ((((a) % m) * ((b) % m)) % m)
#define EPS 1e-9
#define PI acos(-1)
using namespace __gnu_pbds;
using namespace std;
void solve(int tc)
{
    int n;
    cin >> n;
    vector<int> a(n);
    map<int, int> mp;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    vector<int> b = a;
    sort(b.rbegin(), b.rend());
    int r = 1;
    for(int i = 0; i < n; i++){
        if (mp[b[i]] == 0)
            mp[b[i]] = r;
        r++;
    }
    for(int i = 0; i < n; i++){
        cout << mp[a[i]] << nl;
    }
}
signed main(void)
{
    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    int tc = 1;
    //cin >> tc;
    int i = 1;
    while (tc--)
    {
        // cout<<"Case #"<<i<<": ";
        solve(i++);
    }
    return 0;
}

提出情報

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

コンパイルエラー

Main.cpp: In function ‘void solve(long long int)’:
Main.cpp:22:16: warning: unused parameter ‘tc’ [-Wunused-parameter]
   22 | void solve(int tc)
      |                ^

ジャッジ結果

セット名 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 3480 KiB
00_sample_01.txt AC 1 ms 3392 KiB
00_sample_02.txt AC 1 ms 3604 KiB
00_sample_03.txt AC 1 ms 3420 KiB
01_random_00.txt AC 1 ms 3404 KiB
01_random_01.txt AC 1 ms 3448 KiB
01_random_02.txt AC 1 ms 3540 KiB
01_random_03.txt AC 1 ms 3420 KiB
02_random2_00.txt AC 1 ms 3420 KiB
02_random2_01.txt AC 1 ms 3472 KiB
02_random2_02.txt AC 1 ms 3336 KiB
02_random2_03.txt AC 1 ms 3468 KiB
02_random2_04.txt AC 1 ms 3480 KiB
02_random2_05.txt AC 1 ms 3476 KiB
02_random2_06.txt AC 1 ms 3396 KiB
02_random2_07.txt AC 1 ms 3392 KiB
02_random2_08.txt AC 1 ms 3480 KiB
03_sorted_00.txt AC 1 ms 3424 KiB
03_sorted_01.txt AC 1 ms 3428 KiB
04_handmade_00.txt AC 1 ms 3516 KiB
04_handmade_01.txt AC 1 ms 3436 KiB