我的也是84pts
by Cap1taL @ 2023-01-28 19:54:15
此数据会导致我的程序RE,但题解不会
```
2
0 1 1
1 6 1
```
by Cap1taL @ 2023-01-28 20:04:22
一般STL容器的.end()是指向最后一个元素还是最后那个的后面一位?![](//图.tk/0)
by Cap1taL @ 2023-01-28 20:06:05
@[_XHZS_XY_](/user/467107) 我的代码此数据已能过,但仍然是84pts。更改是最后判断时改为==a[i]->end()而不是end()+1
```cpp
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_cxx;
inline int read(){
int x=0,w=1;
char ch=0;
while(ch<'0'||ch>'9'){
if(ch=='-') w=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=x*10+(ch-'0');
ch=getchar();
}
return x*w;
}
rope<int> *a[500005];
int n;
signed main(){
n=read();
a[0]=new rope<int>();
for(int i=1;i<=n;i++){
int v=read(),opt=read(),x=read();
a[i]=new rope<int>(*a[v]);
if(opt==1){
a[i]->insert(lower_bound(a[i]->begin(),a[i]->end(),x)-a[i]->begin(),x);
}else if(opt==2){
auto it=lower_bound(a[i]->begin(),a[i]->end(),x);
if(*it==x){
a[i]->erase(it-a[i]->begin(),1);
}
}else if(opt==3){
printf("%d\n",lower_bound(a[i]->begin(),a[i]->end(),x)-a[i]->begin()+1);
}else if(opt==4){
printf("%d\n",a[i]->at(x-1));
}else if(opt==5){
auto it=lower_bound(a[i]->begin(),a[i]->end(),x);
if(it==a[i]->begin()){
printf("-2147483647\n");
}else{
printf("%d\n",*prev(it));
}
}else if(opt==6){
auto it=upper_bound(a[i]->begin(),a[i]->end(),x);
if(it==a[i]->end()){
printf("2147483647\n");
}else{
printf("%d\n",*it);
}
}
}
return 0;
}
```
by Cap1taL @ 2023-01-28 20:12:45
@[_XHZS_XY_](/user/467107) STL 容器都遵循左闭右开的原则
end()返回末尾迭代器,该迭代器是最后一个元素的后一个
如果需要最后一个元素可以使用rbegin()
by Killer_joke @ 2023-01-28 20:47:24
@[Killer_joke](/user/915814) 确实,谢谢,自己也插到了![](//图.tk/8)但还是RE,已经开摆了,反正也是STL乱搞
验证码fwgg祭
by Cap1taL @ 2023-01-29 08:03:11