BilyHurington @ 2019-04-29 13:14:12
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include<cstdio>
#include<algorithm>
using namespace std;
using namespace __gnu_pbds;
tree<int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> t;
int n,p;
long long ans;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d",&p);
ans+=i-t.order_of_key(p)-1;
t.insert(p);
}
printf("%lld",ans);
}
by BCZSX @ 2019-04-29 13:21:46
@BilyHurington 自己手打吧
by cosmicAC @ 2019-04-29 13:40:07
你确定没有相同数
by BCZSX @ 2019-04-29 13:44:17
@SarvaTathagata 就算有相同的数也不会出问题呀
by cosmicAC @ 2019-04-29 14:01:40
当然会出问题了,因为你是用i减掉的
by 反手for循环 @ 2019-05-25 19:50:54
自己手打的头文件?