36 pts 求助

P1801 黑匣子

```cpp #define int long long//__int128 tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> s; int cnt=1,tmp=0; int f(int k){ auto it=s.find_by_order(k-1); if(it!=s.end()) return *it; else return 114514; } signed main(){ int m,n; cin>>m>>n; int a[m+1],b[n+1]; for(int i=1;i<=m;i++) cin>>a[i]; for(int i=1;i<=n;i++) cin>>b[i]; for(int i=1;i<=m;i++){ s.insert(a[i]); while(i==b[cnt]){ cnt++,tmp++; cout<<f(tmp)<<endl; } } } ```
by Jerrlee✅ @ 2022-10-07 11:13:45


[评测记录](https://www.luogu.com.cn/record/88992965)
by Jerrlee✅ @ 2022-10-07 11:14:04


是不是因为 `pb_ds` 不能重复?
by qwasd @ 2022-10-07 12:14:20


@[qwasd](/user/484970) 什么意思?麻烦具体一点谢谢
by Jerrlee✅ @ 2022-10-07 12:18:53


@[Jerrlee✅](/user/367652) 应该是某些指令c++11以下的没有
by hjsxhst2022 @ 2022-10-07 12:20:27


@[hjsxhst2022](/user/745903) 我是用 C++14 交的,应该没问题(他也没报 CE 就是
by Jerrlee✅ @ 2022-10-07 12:21:32


@[Jerrlee✅](/user/367652) `pb_ds` 的 `tree` 不能插入相同的元素
by qwasd @ 2022-10-07 12:22:16


@[Jerrlee✅](/user/367652) 没报就好
by hjsxhst2022 @ 2022-10-07 12:22:23


@[qwasd](/user/484970) 哦,我去改下试试 谢谢
by Jerrlee✅ @ 2022-10-07 12:22:53


@[Jerrlee✅](/user/367652) c++11也报错: ```cpp /tmp/compiler_jzrhgkpo/src:2:1: 错误:‘tree’不是一个类型名 2 | tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> s; | ^~~~ /tmp/compiler_jzrhgkpo/src: 在函数‘long long int f(long long int)’中: /tmp/compiler_jzrhgkpo/src:5:13: 错误:‘s’在此作用域中尚未声明 5 | auto it=s.find_by_order(k-1); | ^ /tmp/compiler_jzrhgkpo/src: 在函数‘int main()’中: /tmp/compiler_jzrhgkpo/src:11:5: 错误:‘cin’在此作用域中尚未声明 11 | cin>>m>>n; | ^~~ /tmp/compiler_jzrhgkpo/src:16:9: 错误:‘s’在此作用域中尚未声明 16 | s.insert(a[i]); | ^ /tmp/compiler_jzrhgkpo/src:19:13: 错误:‘cout’在此作用域中尚未声明 19 | cout<<f(tmp)<<endl; | ^~~~ /tmp/compiler_jzrhgkpo/src:19:27: 错误:‘endl’在此作用域中尚未声明 19 | cout<<f(tmp)<<endl; | ^~~~ ``` 绝了
by hjsxhst2022 @ 2022-10-07 12:23:31


| 下一页