Submission #139015

#TimeUsernameProblemLanguageResultExecution timeMemory
139015Bohoty고대 책들 (IOI17_books)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "books.h"
using namespace std;
int solve(int idx, int picked, vector < int > &v){
	if (picked == -1 && v[idx] != idx){
		picked = v[idx];
		v[idx] = -1;
	}
	if (picked == idx){
		swap(v[idx], picked);
	}
	if (picked > idx || picked == -1)
		return solve(i + 1, picked, v) + 1;
	else
		return solve(i - 1, picked, v) + 1;
}
long long minimum_walk(std::vector<int> v, int s) {
	solve(s, -1, v);
	return 0;
}

Compilation message (stderr)

books.cpp: In function 'int solve(int, int, std::vector<int>&)':
books.cpp:13:16: error: 'i' was not declared in this scope
   return solve(i + 1, picked, v) + 1;
                ^
books.cpp:15:16: error: 'i' was not declared in this scope
   return solve(i - 1, picked, v) + 1;
                ^