# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
69260 | Bruteforceman | 고대 책들 (IOI17_books) | C++11 | 6 ms | 700 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "books.h"
#include "bits/stdc++.h"
using namespace std;
long long minimum_walk(std::vector<int> p, int s) {
bool good = true;
for(int i = 0; i < p.size(); i++) {
if(p[i] != i) {
good = false;
}
}
if(good) return 0;
int l = 0;
int r = p.size() - 1;
long long ans = 0;
while(l < p.size() && p[l] == l) {
if(s == l) {
ans += 2;
++s;
}
++l;
}
while(r >= 0 && p[r] == r) {
if(s == r) {
ans += 2;
--s;
}
--r;
}
for(int i = l; i < r; i++) {
int go_left = 0;
int go_right = 0;
for(int j = l; j <= i; j++) {
if(p[j] > i) {
++go_left;
}
}
for(int j = i + 1; j <= r; j++) {
if(p[j] < i+1) {
++go_right;
}
}
assert(go_left == go_right);
ans += go_left + go_right;
}
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... |