| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 734221 | Amaarsaa | 팬케이크 정렬 (NOI12_pancake) | C++14 | 1075 ms | 212 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
 
using namespace std;
using ll = long long;
ll n, ans, p, j, s;
void Dfs(ll a[], ll  moves) {
	if ( moves >= ans) return;
	s = 0;
	for (ll i = 1; i < n; i ++) {
		if ( a[i] <=a[i + 1]) s = 1;
	}
	if ( s == 0) {
		
		ans = min(moves, ans);
		return;
	}
	for (ll i = 1; i <= n; i ++) {
		reverse(a + i,a +n + 1);
		Dfs(a, moves + 1);
		reverse(a + i, a + n + 1);
	}
	return ;
}
int main() {
	ll i, t, r;
	cin >> t;
	
	while ( t --) {
		cin >> n;
		ans = 2 * n;
		ll a[n + 2];
		for (i = 1; i <= n; i ++) {
			cin >> a[i];
		}
		Dfs(a, 0);
		cout <<ans << endl;
	}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
