# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1108458 | Tahmid690 | Arranging Shoes (IOI19_shoes) | C++14 | 217 ms | 149024 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"
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T> using o_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T, typename R> using o_map = tree<T, R, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long
#define N 200005
queue<int> Q[N];
long long count_swaps(std::vector<int> s) {
int n=s.size()/2;
vector<int> dst;
for(auto u:s){
if(u<0){
dst.push_back(u);
dst.push_back(-u);
}
}
for(int i=0;i<dst.size();i++){
Q[dst[i]+n].push(i+1);
}
vector<int> inv;
for(auto u:s){
inv.push_back(Q[u+n].front());
Q[u+n].pop();
}
ll cnt=0;
o_set<int> st;
for(auto u:inv){
cnt+=st.order_of_key(-u);
st.insert(-u);
}
return cnt;
}
Compilation message (stderr)
# | 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... |