| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 42954 | MatheusLealV | Ancient Books (IOI17_books) | C++14 | 3 ms | 480 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define N 501
using namespace std;
typedef long long ll;
int n, s, ans[1000050];
ll minimum_walk(vector<int> v, int s_)
{
ll sum = 0, last = 0;
n = v.size(), s = s_;
int pos = 0;
while(true)
{
int nop = 0;
for(int i = 0; i < n; i++)
{
if(v[i] != i) nop ++;
}
if(!nop) break;
if(v[pos] == pos)
{
pos ++;
sum ++;
continue;
}
int sv = pos;
cout<<"FROM "<<pos<<" TO "<<v[pos]<<"\n";
sum += abs(v[pos] - pos);
pos = v[pos];
last = pos;
v[sv] = sv;
}
return sum + last;
}| # | 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... | ||||
