# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
265363 | arayi | Ancient Books (IOI17_books) | C++17 | 0 ms | 0 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>
#define lli long long
using namespace std;
int n;
long long mek()
{
return 0;
}
lli erku()
{
if(p[1] == 1) return 0;
return 2;
}
lli ereq()
{
if(p[2] == 2) return erku();
return 4;
}
lli chors()
{
if(p[3] == 3) return ereq();
if(p[0] > 1 && p[1] > 1) return 8;
return 6;
}
long long minimum_walk(vector<int> p, int s) {
n = p.size();
if(n == 1) return mek();
if(n == 2) return erku();
if(n == 3) return ereq();
return chors();
}