# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
132794 | Talant | Ancient Books (IOI17_books) | C++17 | 2 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "books.h"
#include <bits/stdc++.h>
#define sc second
#define fr first
#define mk make_pair
#define pb push_back
using namespace std;
const int N = (1e6 + 5);
const int inf = (1e9 + 7);
int a[N];
int u[N];
int n;
long long ans;
long long minimum_walk(vector<int> p, int s) {
n = p.size();
s ++;
for (int i = 0; i < n; i ++) a[i + 1] = p[i] + 1,ans += abs(p[i] - i);
int last = s;
for (int i = 1; i <= n; i ++) {
if (a[i] > i) {
for (int j = i + 1; j <= last; j ++) {
if (a[j] < j && i < a[j] && a[j] < 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... |