Submission #66331

# Submission time Handle Problem Language Result Execution time Memory
66331 2018-08-10T08:50:48 Z FedericoS Ancient Books (IOI17_books) C++14
0 / 100
28 ms 676 KB
#include <iostream>
#include <algorithm>
#include "books.h"
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pll;

int N,S;
ll P[1000006];
ll ans;

long long minimum_walk(std::vector<int> q, int s) {

    N=q.size();
    S=s;
    for(ll i=0;i<N;i++){
        P[i]=q[i];
        ans+=abs(P[i]-i);
    }

    for(ll i=0;P[i]==i;i++)
        ans+=2;

    for(ll i=N-1;P[i]==i;i--)
        ans-=2;

    return ans;

}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 28 ms 564 KB Output is correct
4 Correct 2 ms 564 KB Output is correct
5 Incorrect 2 ms 564 KB 3rd lines differ - on the 1st token, expected: '4', found: '2'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 28 ms 564 KB Output is correct
4 Correct 2 ms 564 KB Output is correct
5 Incorrect 2 ms 564 KB 3rd lines differ - on the 1st token, expected: '4', found: '2'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 28 ms 564 KB Output is correct
4 Correct 2 ms 564 KB Output is correct
5 Incorrect 2 ms 564 KB 3rd lines differ - on the 1st token, expected: '4', found: '2'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 676 KB 3rd lines differ - on the 1st token, expected: '3304', found: '2744'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 28 ms 564 KB Output is correct
4 Correct 2 ms 564 KB Output is correct
5 Incorrect 2 ms 564 KB 3rd lines differ - on the 1st token, expected: '4', found: '2'
6 Halted 0 ms 0 KB -