답안 #139014

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
139014 2019-07-31T07:45:06 Z Bohoty 고대 책들 (IOI17_books) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "books.h"
using namespace std;
void 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)
		solve(i + 1, picked, v);
	else
		solve(i - 1, picked, v);
}
long long minimum_walk(std::vector<int> v, int s) {
	solve(s, -1, v);
	return 0;
}

Compilation message

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