| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 936858 | 4QT0R | Arranging Shoes (IOI19_shoes) | C++17 | 71 ms | 134996 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
queue<pair<int,int>> pos[200004];
ll count_swaps(vector<int> S){
ll n=S.size(),open=0,odp=0;
for (int i = 0; i<n; i++){
if (S[i]>0){
if (pos[S[i]+100000].empty()){
pos[S[i]].push({i,open});
open++;
}
else{
odp+=i-pos[S[i]+100000].front().first-1;
open--;
odp-=open-pos[S[i]+100000].front().second;
pos[S[i]+100000].pop();
}
}
else{
if (pos[-S[i]].empty()){
pos[100000-S[i]].push({i,open});
open++;
}
else{
odp+=i-pos[-S[i]].front().first;
open--;
odp-=open-pos[-S[i]].front().second;
pos[-S[i]].pop();
}
}
}
return odp;
}| # | 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... | ||||
