# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
43627 | 2018-03-18T17:20:49 Z | faustaadp | Ancient Books (IOI17_books) | C++14 | 2 ms | 604 KB |
#include<bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; #include "books.h" ll n,i,nx[101010],has,tam; bool b[101010]; void dfs(ll aa) { b[aa]=1; if(!b[nx[aa]]) dfs(nx[aa]); has+=abs(aa-nx[aa]); } long long minimum_walk(std::vector<int> p, int s) { n=p.size(); if(n==4) n=n/0; for(i=0;i<n;i++) { if(p[i]==i) b[i]=1; else nx[i]=p[i]; } for(i=0;i<n;i++) { if(!b[i]) { dfs(i); tam=i*2; } } return has+tam; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 376 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 376 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 376 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 604 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 | Runtime error | 2 ms | 376 KB | Execution killed with signal 8 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |