# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
667289 | Darren0724 | Group Photo (JOI21_ho_t3) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
struct BIT{
vector<int> v;
int n;
BIT(int n1){
n=n1;
v.resize(n+1);
}
void add(int p,int x){
for(int i=p;i<=n;i+=i&(-i)){
v[i]+=x;
}
}
int ask(int p){
int ans=0;
for(int i=p;i>0;i-=i&(-i)){
ans+=v[i];
}
return ans;
}
};
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;cin>>n;
vector<int> pos(n+1);
vector<vector<int>> cnt(n+2,vector<int>(n+2));
for(int i=1;i<=n;i++){
int k;cin>>k;