Submission #1259786

#TimeUsernameProblemLanguageResultExecution timeMemory
1259786FaggiAncient Books (IOI17_books)C++20
12 / 100
0 ms328 KiB
#include <bits/stdc++.h>
#define ll long long
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define fr first
#define se second
using namespace std;
long long minimum_walk(std::vector<int> p, int s)
{
    ll i, j, n = sz(p), pos, ult = s, tot = 0, in = s;
    if (p[0] <= 1)
    {
        ll ul = 0;
        for (j = 0; j < sz(p); j++)
        {
            if (p[j] != j)
                ul = j;
        }
        tot = (ul * 2);
        return tot;
    }
    else if(p[0]==2)
    {
        if(p[1]==3)
        {
            return 8;
        }
        else
        {
            ll ul = 0;
            for (j = 0; j < sz(p); j++)
            {
                if (p[j] != j)
                    ul = j;
            }
            tot = (ul * 2);
            return tot;
        }
    }
    else
    {
        if(p[1]==2)
        {
            return 8;
        }
        else
        {
            ll ul = 0;
            for (j = 0; j < sz(p); j++)
            {
                if (p[j] != j)
                    ul = j;
            }
            tot = (ul * 2);
            return tot;
        }
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...