d794. 世界排名 - 高中生程式解題系統

本文最後更新於:2024年1月12日 下午

Zerojudge
解題紀錄

d794. 世界排名 - 高中生程式解題系統

Zerojudge-d794.cpp

// Author : ysh
// 01/23/2023 Mon  7:40:36.31
#include<bits/stdc++.h>
#include<bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    while(cin>>n) {
        tree<pair<int,int>,null_type,greater<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>t;
        int tt = 1;
        while(n--) {
            int tmp;cin>>tmp;
            t.insert({tmp,tt++});
            // cerr<<t.upper_bound({tmp,0})->second;
            cout<<t.order_of_key(*t.upper_bound({tmp + 1,0})) + 1<<"\n";
        }
    }
    return 0;
}

d794. 世界排名 - 高中生程式解題系統
http://mysh212.github.io/algosolution/Zerojudge-d794.cpp/
作者
ysh
發布於
2023年1月23日
更新於
2024年1月12日
許可協議