# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
289294 | 2020-09-02T14:15:42 Z | Touubs | Ancient Books (IOI17_books) | C++17 | 1 ms | 256 KB |
#include "books.h" #include <bits/stdc++.h> long long minimum_walk(std::vector<int> p, int s) { std::vector<bool> visited(p.size()); long long res = 0; int maxVis = 0; int i; for (i = 0; i < p.size() && p[i] == i && i < s; i++); int top = p.size() - 1; for (; i <= top; i++) { if (maxVis < i) res+=2; res += abs(p[i] - i); maxVis = std::max(maxVis, p[i]); } //for (int i = p.size() - 1; i > 0 && p[i] == i && i > s; res -= 2, i--); return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 0 ms | 256 KB | Output is correct |
5 | Incorrect | 0 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '4', found: '6' |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 0 ms | 256 KB | Output is correct |
5 | Incorrect | 0 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '4', found: '6' |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 0 ms | 256 KB | Output is correct |
5 | Incorrect | 0 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '4', found: '6' |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '3304', found: '2744' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 0 ms | 256 KB | Output is correct |
5 | Incorrect | 0 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '4', found: '6' |
6 | Halted | 0 ms | 0 KB | - |