# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
423542 | 2021-06-11T09:09:37 Z | Bill_00 | Ancient Books (IOI17_books) | C++14 | 1 ms | 204 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){ ans+=(i-pre); dfs(i); pre=i; } } return ans+pre; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 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 | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 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 | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 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 | 204 KB | 3rd lines differ - on the 1st token, expected: '3304', found: '4736' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | 3rd lines differ - on the 1st token, expected: '6', found: '8' |
3 | Halted | 0 ms | 0 KB | - |