| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 283544 | test2 | Arranging Shoes (IOI19_shoes) | C++14 | 1 ms | 256 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "shoes.h"
#define I inline void
using namespace std ;
using ll = long long ;
using ld = long double ;
const int N = 3000 + 7 , mod = 1e9 + 7 ;
// How interesting!
int n;
long long count_swaps(std::vector<int> s) {
map<int,vector<int> > mp ;
ll ret = 1e9 ;
vector<pair<int,int>> v ;
int pos = 0 ;
for(auto u : s){
if(mp[-u].size()){
v.push_back({mp[-u].back() , pos}) ;
mp[-u].pop_back() ;
}
else{
mp[u].push_back(pos) ;
}
pos ++ ;
}
int n = (int) s.size() ;
vector<int> per ;
for(int i = 0 ;i < n / 2 ;i ++){
per.push_back(i) ;
}
for(auto u : v){
//cout<< u.first <<" " << u.second <<"..\n" ;
}
do{
int k = 0;
ll ret1 = 0 ;
for(int i = 0 ; i < n/2 ;i++){
pair<int,int> u = v[per[i]] ;
int l = u.first , r = u.second ;
if(s[l] > s[r])
swap(l , r) ;
ret1+= abs(k - l) ;
ret1+= abs((k+1) - r) ;
k+= 2;
}
ret = min(ret , ret1/2) ;
}
while(next_permutation(per.begin() , per.end())) ;
return ret;
}
컴파일 시 표준 에러 (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... | ||||
