# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
242167 | dCoding | Arranging Shoes (IOI19_shoes) | C++14 | 352 ms | 275704 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.
/**
For all shoes, greedily find the other closest pair near it.
The number of swaps required for that move is the index of the closest pair - current index - number of used shoes in between
The number of used shoes in between can be found using a segtree
*/
#include <bits/stdc++.h>
#include "shoes.h"
#define F0R(i,n) for(auto i = 0; i < (n); i++)
#define FOR(i,a,b) for(auto i = (a); i <= (b); i++)
#define ROF(i,a,b) for(auto i = (a); i >= (b); i--)
#define ll long long
#define pb push_back
#define F first
#define S second
#define vi vector<int>
using namespace std;
const int MAXN = 2e5+5;
int seg[4*MAXN];
bool used[MAXN];
queue<int> leftShoes[MAXN],rightShoes[MAXN];
void update(int node,int ss,int se,int idx) {
if(ss > se || idx > se || idx < ss)return;
if(ss == se) {
++seg[node];
return;
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... |