답안 #429169

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
429169 2021-06-15T18:05:58 Z vanic 고대 책들 (IOI17_books) C++14
12 / 100
279 ms 332 KB
#include "books.h"
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long ll;

const int inf=100;

int n;
const int cap=10;

int rek(int x, int d, int t, vector < int > l){
	if(d>cap || x>=n || x<0){
		return inf;
	}
	if(!x){
		bool p=1;
		if(l[0]!=0 && t){
			p=0;
		}
		for(int i=1; i<n; i++){
			if(l[i]!=i){
				p=0;
				break;
			}
		}
		if(p){
			return d;
		}
	}
	int mini=inf;
	mini=min(mini, rek(x+1, d+1, t, l));
	mini=min(mini, rek(x-1, d+1, t, l));
	swap(l[x], t);
	mini=min(mini, rek(x+1, d+1, t, l));
	mini=min(mini, rek(x-1, d+1, t, l));
	return mini;
}


ll minimum_walk(vector < int > p, int s) {
	n=p.size();
	return rek(0, 0, -1, p);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 204 KB Output is correct
2 Correct 17 ms 204 KB Output is correct
3 Correct 17 ms 288 KB Output is correct
4 Correct 7 ms 288 KB Output is correct
5 Correct 16 ms 204 KB Output is correct
6 Correct 17 ms 204 KB Output is correct
7 Correct 17 ms 204 KB Output is correct
8 Correct 21 ms 204 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 16 ms 204 KB Output is correct
11 Correct 1 ms 288 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 17 ms 292 KB Output is correct
14 Correct 1 ms 288 KB Output is correct
15 Correct 17 ms 292 KB Output is correct
16 Correct 17 ms 204 KB Output is correct
17 Correct 16 ms 204 KB Output is correct
18 Correct 17 ms 292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 204 KB Output is correct
2 Correct 17 ms 204 KB Output is correct
3 Correct 17 ms 288 KB Output is correct
4 Correct 7 ms 288 KB Output is correct
5 Correct 16 ms 204 KB Output is correct
6 Correct 17 ms 204 KB Output is correct
7 Correct 17 ms 204 KB Output is correct
8 Correct 21 ms 204 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 16 ms 204 KB Output is correct
11 Correct 1 ms 288 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 17 ms 292 KB Output is correct
14 Correct 1 ms 288 KB Output is correct
15 Correct 17 ms 292 KB Output is correct
16 Correct 17 ms 204 KB Output is correct
17 Correct 16 ms 204 KB Output is correct
18 Correct 17 ms 292 KB Output is correct
19 Incorrect 275 ms 332 KB 3rd lines differ - on the 1st token, expected: '338572', found: '100'
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 204 KB Output is correct
2 Correct 17 ms 204 KB Output is correct
3 Correct 17 ms 288 KB Output is correct
4 Correct 7 ms 288 KB Output is correct
5 Correct 16 ms 204 KB Output is correct
6 Correct 17 ms 204 KB Output is correct
7 Correct 17 ms 204 KB Output is correct
8 Correct 21 ms 204 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 16 ms 204 KB Output is correct
11 Correct 1 ms 288 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 17 ms 292 KB Output is correct
14 Correct 1 ms 288 KB Output is correct
15 Correct 17 ms 292 KB Output is correct
16 Correct 17 ms 204 KB Output is correct
17 Correct 16 ms 204 KB Output is correct
18 Correct 17 ms 292 KB Output is correct
19 Incorrect 275 ms 332 KB 3rd lines differ - on the 1st token, expected: '338572', found: '100'
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 279 ms 332 KB 3rd lines differ - on the 1st token, expected: '3304', found: '100'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 204 KB Output is correct
2 Correct 17 ms 204 KB Output is correct
3 Correct 17 ms 288 KB Output is correct
4 Correct 7 ms 288 KB Output is correct
5 Correct 16 ms 204 KB Output is correct
6 Correct 17 ms 204 KB Output is correct
7 Correct 17 ms 204 KB Output is correct
8 Correct 21 ms 204 KB Output is correct
9 Correct 1 ms 292 KB Output is correct
10 Correct 16 ms 204 KB Output is correct
11 Correct 1 ms 288 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 17 ms 292 KB Output is correct
14 Correct 1 ms 288 KB Output is correct
15 Correct 17 ms 292 KB Output is correct
16 Correct 17 ms 204 KB Output is correct
17 Correct 16 ms 204 KB Output is correct
18 Correct 17 ms 292 KB Output is correct
19 Incorrect 275 ms 332 KB 3rd lines differ - on the 1st token, expected: '338572', found: '100'
20 Halted 0 ms 0 KB -