# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
423552 | 2021-06-11T09:21:36 Z | Bill_00 | Ancient Books (IOI17_books) | C++14 | 1 ms | 304 KB |
#include "books.h" #include <bits/stdc++.h> #define ll long long using namespace std; ll vis[1000005],ans,p[1000005]; void dfs(int node){ vis[node]=1; ans+=(abs(p[node]-node)); if(vis[p[node]]==1){ return; } dfs(p[node]); } long long minimum_walk(std::vector<int> P, int s){ int pre=0; for(int i=0;i<P.size();i++) p[i]=P[i]; for(int i=0;i<P.size();i++){ if(vis[i]==0 && i!=p[i]){ ans+=(i-pre); dfs(i); pre=i; } } return ans+pre; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 216 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 304 KB | Output is correct |
6 | Incorrect | 1 ms | 204 KB | 3rd lines differ - on the 1st token, expected: '8', found: '10' |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 216 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 304 KB | Output is correct |
6 | Incorrect | 1 ms | 204 KB | 3rd lines differ - on the 1st token, expected: '8', found: '10' |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 216 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 304 KB | Output is correct |
6 | Incorrect | 1 ms | 204 KB | 3rd lines differ - on the 1st token, expected: '8', found: '10' |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | 3rd lines differ - on the 1st token, expected: '3304', found: '4728' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 216 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 304 KB | Output is correct |
6 | Incorrect | 1 ms | 204 KB | 3rd lines differ - on the 1st token, expected: '8', found: '10' |
7 | Halted | 0 ms | 0 KB | - |