# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1082118 | logangd | Arranging Shoes (IOI19_shoes) | C++14 | 106 ms | 19664 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 "shoes.h"
using namespace std;
vector<int>p[300005],a(800005);
void bld(int nd,int l,int r){
if(l==r)return a[nd]=1,void();
int md=(l+r)/2;
bld(nd*2,l,md);
bld(nd*2+1,md+1,r);
a[nd]=a[nd*2]+a[nd*2+1];
}
void res(int p,int nd,int l,int r){
if(l==r)return a[nd]=0,void();
int md=(l+r)/2;
if(p<=md)res(p,nd*2,l,md);
else res(p,nd*2+1,md+1,r);
a[nd]=a[nd*2]+a[nd*2+1];
}
int qry(int p,int q,int nd,int l,int r){
if(q<l||r<p)return 0;
if(p<=l&&r<=q)return a[nd];
int md=(l+r)/2;
return qry(p,q,nd*2,l,md)+qry(p,q,nd*2+1,md+1,r);
}
long long count_swaps(vector<int>s){
int n=s.size();
bld(1,0,n-1);
for(int i=n-1;0<=i;i--)p[s[i]+n].push_back(i);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |