# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
123089 | SirCeness | Ancient Books (IOI17_books) | C++14 | 2 ms | 424 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 <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define inside sl<=l&&r<=sr
#define outside r<sl||sr<l
#define inf 1000000009
using namespace std;
typedef long long ll;
int n;
vector<int> arr;
vector<ll> numara;
int num = 0;
vector<pair<ll, ll> > minler;
ll minimum_walk(vector<int> p, int s){
if (p.size() == 1){
return 0;
} else if (p.size() == 2){
return (p[0] == 0) ? 0 : 2;
} else if (p.size() == 3){
if (p[0] == 0){
if (p[1] == 1){
// 0 1 2
return 0;
} else {
// 0 2 1
return 4;
}
} else if (p[0] == 1){
if (p[1] == 0){
// 1 0 2
return 2;
} else {
// 1 2 0
return 4;
}
} else {
if (p[0] == 0){
// 2 0 1
return 4;
} else {
// 2 1 0
return 4;
}
}
}
if (p[0] == 0){
if (p[1] == 1){
if (p[2] == 2){
// 0 1 2 3
return 0;
} else {
// 0 1 3 2
return 6;
}
} else if (p[1] == 2){
if (p[2] == 1){
// 0 2 1 3
return 4;
} else {
// 0 2 3 1
return 6;
}
} else if (p[1] == 3){
if (p[2] == 1){
// 0 3 1 2
return 6;
} else {
// 0 3 2 1
return 6;
}
}
} else if (p[0] == 1){
if (p[1] == 0){
if (p[2] == 2){
// 1 0 2 3
return 2;
} else {
// 1 0 3 2
return 6;
}
} else if (p[1] == 2){
if (p[2] == 0){
// 1 2 0 3
return 4;
} else {
// 1 2 3 0
return 6;
}
} else if (p[1] == 3){
if (p[2] == 0){
// 1 3 0 2
return 6;
} else {
// 1 3 2 0
return 6;
}
}
} else if (p[0] == 2){
if (p[1] == 0){
if (p[2] == 1){
// 2 0 1 3
return 4;
} else {
// 2 0 3 1
return 6;
}
} else if (p[1] == 1){
if (p[2] == 0){
// 2 1 0 3
return 4;
} else {
// 2 1 3 0
return 6;
}
} else if (p[1] == 3){
if (p[2] == 0){
// 2 3 0 1
return 8;
} else {
// 2 3 1 0
return 8;
}
}
} else if (p[0] == 3){
if (p[1] == 0){
if (p[2] == 1){
// 3 0 1 2
return 6;
} else {
// 3 0 2 1
return 6;
}
} else if (p[1] == 1){
if (p[2] == 0){
// 3 1 0 2
return 6;
} else {
// 3 1 2 0
return 6;
}
} else if (p[1] == 2){
if (p[2] == 0){
// 3 2 0 1
return 8;
} else {
// 3 2 1 0
return 8;
}
}
} else return 159;
}
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... |