Submission #920927

# Submission time Handle Problem Language Result Execution time Memory
920927 2024-02-03T07:57:06 Z salmon Ancient Books (IOI17_books) C++14
Compilation error
0 ms 0 KB
#include "books.h"

long long minimum_walk(std::vector<int> p, int s) {
    long long sum = 0;

    for(int i = 0; i < N; i++){
        sum += abs(p[i] - i);
    }
    return sum + 2;
}

Compilation message

books.cpp: In function 'long long int minimum_walk(std::vector<int>, int)':
books.cpp:6:24: error: 'N' was not declared in this scope
    6 |     for(int i = 0; i < N; i++){
      |                        ^
books.cpp:7:16: error: 'abs' was not declared in this scope
    7 |         sum += abs(p[i] - i);
      |                ^~~