# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
758388 | Trumling | Arranging Shoes (IOI19_shoes) | C++14 | 1093 ms | 4308 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "shoes.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define F first
#define S second
#define enter cout<<'\n';
#define INF 99999999999999999
#define MOD 1000000007
#define all(x) x.begin(),x.end()
long long count_swaps(std::vector<int> s)
{
ll nn=s.size();
vector<int>v(nn);
for(int i=0;i<nn;i+=2)
v[i/2]=i;
ll ans=INF;
do
{
bool tf=1;
ll idx=0;
vector<int>g(nn,-1);
for(int i=0;i<nn;i++)
if(s[i]<0)
g[i]=v[idx++];
if(!tf)
continue;
ll curr=0;
vector<int>now(nn);
for(int i=0;i<nn;i++)
now[i]=i;
bool taken[nn]={ };
idx=0;
for(int r=0;r<nn;r++)
for(int i=0;i<nn;i++)
{
if(g[i]==idx)
{
for(int j=i-1;j>=idx;j--)
{
swap(now[j],now[j+1]);
swap(g[j],g[j+1]);
curr++;
}
for(int j=idx+1;j<nn;j++)
if(!taken[j] && s[now[j]]+s[now[idx]]==0)
{
taken[j]=1;
for(int c=j-1;c>=idx+1;c--)
{
swap(now[c],now[c+1]);
swap(g[c],g[c+1]);
curr++;
}
break;
}
idx+=2;
break;
}
}
ans=min(ans,curr);
}while(next_permutation(all(v)));
return ans;
}
컴파일 시 표준 에러 (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... |