# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
136677 | Boxworld | Ancient Books (IOI17_books) | C++14 | 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>
using namespace std;
long long minimum_walk(std::vector<int> p, int s) {
int n=p.size();
if (s==0){
if (n==1)return 0;
if (n==2){
if (p[0]==0)return 0;
else return 2;
}
if (n==3){
if (p[0]==0&&p[1]==1)return 0;
if (p[0]==0&&p[1]==2)return 4;
if (p[0]==1&&p[1]==0)return 2;
if (p[0]==1&&p[1]==2)return 4;
if (p[0]==2&&p[1]==0)return 4;
if (p[0]==2&&p[1]==1)return 4;
}else if (n==4){
if (p[0]==0&&p[1]==1&&p[2]==2)return 0;
if (p[0]==0&&p[1]==1&&p[2]==3)return 6;
if (p[0]==0&&p[1]==2&&p[2]==1)return 4;
if (p[0]==0&&p[1]==2&&p[2]==3)return 6;
if (p[0]==0&&p[1]==3&&p[2]==1)return 6;
if (p[0]==0&&p[1]==3&&p[2]==2)return 6;
if (p[0]==1&&p[1]==0&&p[2]==2)return 2;
if (p[0]==1&&p[1]==0&&p[2]==3)return 6;
if (p[0]==1&&p[1]==2&&p[2]==0)return 4;
if (p[0]==1&&p[1]==2&&p[2]==3)return 6;
if (p[0]==1&&p[1]==3&&p[2]==0)return 6;
if (p[0]==1&&p[1]==3&&p[2]==2)return 6;
if (p[0]==2&&p[1]==0&&p[2]==1)return 4;
if (p[0]==2&&p[1]==0&&p[2]==3)return 6;
if (p[0]==2&&p[1]==1&&p[2]==0)return 4;
if (p[0]==2&&p[1]==1&&p[2]==3)return 6;
if (p[0]==2&&p[1]==3&&p[2]==0)return 6;
if (p[0]==2&&p[1]==3&&p[2]==1)return 6;
if (p[0]==3&&p[1]==0&&p[2]==1)return 6;
if (p[0]==3&&p[1]==0&&p[2]==2)return 6;
if (p[0]==3&&p[1]==1&&p[2]==0)return 6;
if (p[0]==3&&p[1]==1&&p[2]==2)return 6;
if (p[0]==3&&p[1]==2&&p[2]==0)return 8;
if (p[0]==3&&p[1]==2&&p[2]==1)return 8;
}
}
}
Compilation message (stderr)
# | 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... |