Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
35111 杯总 [CSP-J2021]插入排序 C++ 通过 100 843 MS 428 KB 593 2021-12-13 13:41:30

Tests(25/25):


#include <bits/stdc++.h> using namespace std; pair<int,int>b[8005]; int n,q,a[8005]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin>>n>>q; for (int i=1; i<=n; ++i) { cin>>a[i]; b[i]= {a[i],i}; } stable_sort(b+1,b+n+1); for (int i=1,o,x,v; i<=q; ++i) { cin>>o; if (o==1) { cin>>x>>v; a[x]=lower_bound(b+1,b+n+1,make_pair(a[x],x))->first=v; stable_sort(b+1,b+n+1); } else { cin>>x; cout<<lower_bound(b+1,b+n+1,make_pair(a[x],x))-&b[0]<<'\n'; } } return 0; }


测评信息: