Submission #1048268

#TimeUsernameProblemLanguageResultExecution timeMemory
1048268LittleOrangeAncient Books (IOI17_books)C++17
Compilation error
0 ms0 KiB
#include "books.h" #include<bits/stdc++.h> using namespace std; using ll = long long; long long minimum_walk(std::vector<int> p, int s) { ll ans = 0; ll n = p.size(); if (s == 0){ vector<ll> u(n,0); for(ll i = 0;i<n;i++){ if(p[i]!=i){ ans += i-s; s = i; ll x = i; do{ ans += ans(p[x]-x); ll y = x; x = p[x]; p[y] = y; } while(x!=i); } } } return ans; }

Compilation message (stderr)

books.cpp: In function 'long long int minimum_walk(std::vector<int>, int)':
books.cpp:16:23: error: 'ans' cannot be used as a function
   16 |      ans += ans(p[x]-x);
      |                       ^