| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1324841 | fahmid_rng | Arranging Shoes (IOI19_shoes) | C++20 | 31 ms | 6556 KiB |
#include<bits/stdc++.h>
#include "shoes.h"
using namespace std;
using ll=long long;
long long count_swaps(std::vector<int> s) {
ll ans=0;
set<int> pos;
for(int i=0;i<s.size();++i){if(s[i]<0) pos.insert(i);}
for(int i=0;i<s.size();i+=2){
auto low=pos.lower_bound(i);
if(low==pos.begin()){
ans+=(*low-i);
pos.erase(low);
continue;
}
auto up=low--;
if(up==pos.end()||i-*low<*up-i){
ans+=(i-*low);
pos.erase(low);
continue;
}
ans+=*up-i;
pos.erase(up);
}
return ans;
}
| # | 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... | ||||
