# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
105238 | puyu_liao | Ancient Books (IOI17_books) | C++14 | 3 ms | 432 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define IOS {cin.tie(0);ios_base::sync_with_stdio(false);}
#include"books.h"
typedef long long lll;
#define N 100005
bitset<N> vis;
lll minimum_walk(vector<int> p,int s){
vis.reset();
int ll = s,rr = s,gl,gr;
lll ans = 0;
for(int i=0;i<p.size();) if(!vis[i]){
gl = p.size()+1, gr = -1;
int j = i;
do{
int t = j;
if(vis[t]) {
j++;
continue;
}
vis[t] = 1;
while(!vis[p[t]]){
gl = min(gl,t); gr = max(gr,t);
vis[p[t]] = 1;
ans += abs(p[t] - t);
t = p[t];
gl = min(gl,t); gr = max(gr,t);
}
ans += abs(p[t] - t);
j++;
}while(j<=gr);
if(gl <= gr && gr < s) ll = min(ll,gr);
if(gl <= gr && gl > s) rr = max(rr,gl);
i = j;
}
return ans + rr+rr-ll-ll;
}
컴파일 시 표준 에러 (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... |