# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
566255 | 2022-05-22T07:57:41 Z | sofapuden | Ancient Books (IOI17_books) | C++14 | 1 ms | 304 KB |
#include "books.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; ll minimum_walk(vector<int> p, int s) { ll su = 0; int mx = 0; int n = p.size(); vector<int> vis(n,0); ll ans = 0; for(int i = 0; i < n; ++i){ ans+=abs(i-p[i]); if(!vis[i]){ ans+=2; while(!vis[i]){ vis[i] = 1; i = p[i]; } } } return ans-2; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 304 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | 3rd lines differ - on the 1st token, expected: '6', found: '8' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 304 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | 3rd lines differ - on the 1st token, expected: '6', found: '8' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 304 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | 3rd lines differ - on the 1st token, expected: '6', found: '8' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | 3rd lines differ - on the 1st token, expected: '3304', found: '4186' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 304 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | 3rd lines differ - on the 1st token, expected: '6', found: '8' |
3 | Halted | 0 ms | 0 KB | - |