d788. 排名順序 - 高中生程式解題系統

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

Zerojudge
解題紀錄

d788. 排名順序 - 高中生程式解題系統

Zerojudge-d788-2.cpp

// Author : ysh
// 09/03/2022 Sat 19:28:03.83
#include<bits/stdc++.h>
#include<bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
#define int long long
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    while(cin>>n) {
        tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>f;
        int t = 0;
        for(int i = 0;i<n;i++) {
            int tmp;cin>>tmp;
            f.insert((tmp << 18) + t++);
            cout<<(i + 1) - (f.order_of_key(*f.lower_bound((tmp << 18))))<<"\n";
        }
    }
    return 0;
}

d788. 排名順序 - 高中生程式解題系統
http://mysh212.github.io/algosolution/Zerojudge-d788-2.cpp/
作者
ysh
發布於
2022年9月3日
更新於
2024年1月12日
許可協議