#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
using namespace __gnu_pbds;
- これね。K番目の値をlogNで取り出せるsetのようなデータ構造(tree)が使えるそう
ext以下がほしい
/usr/local/include/ext/pb_ds/assoc_container.hpp:44:10:
fatal error: 'bits/c++config.h' file not found
- 見てみると、c++config(拡張子なし)が存在したので.hを付けてみる
- 別のヘッダファイルがないと表示される
- お手上げ
- 気が向いたらリベンジしよう
追記
使うと楽な問題
軽く使ってみた
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int main(){
ordered_set se;
se.insert(2);
se.insert(7);
se.insert(5);
ll v = *se.find_by_order(1);
debug(v);
return 0;
}
[v]: 5