답안 #162861

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
162861 2019-11-10T06:56:00 Z cerberus On the Grid (FXCUP4_grid) C++17
0 / 100
2 ms 276 KB
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
#include "grid.h"

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e3 + 10;

vector<int> SortDisks(int n) {
	vector<int> perm(n), ans(n);
	vector<bool> used(n, false);
	iota(perm.begin(), perm.end(), 0);
	int p_val = PutDisks(perm);
	int cnt = n;
	while (true) {
		rotate(perm.begin(), perm.begin() + cnt - 1, perm.begin() + cnt);
		int val = PutDisks(perm);
		if (val >= p_val) {
			ans[perm[0]] = val - n + 1;
			used[val - n + 1] = true;
			rotate(perm.begin(), perm.begin() + 1, perm.begin() + cnt);
			--cnt;
			if (cnt == 1) {
				break;
			}
			sort(perm.begin() + cnt, perm.begin() + n, [&] (int x, int y) {
				return ans[x] < ans[y];
			});
			p_val = PutDisks(perm);
		} else {
			p_val = val;
		}
	}
	ans[perm[0]] = 1;
	while (used[ans[perm[0]]]) {
		++ans[perm[0]];
	}
	// for (int i = 0; i < n; ++i) {
	// 	cout << ans[i] << ' ';
	// }
	// cout << endl;
	return ans;
	// int X = PutDisks(std::vector<int>{0,2,3,1});
	// return std::vector<int>{1,X,2,3};
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 276 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 276 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 276 KB Output isn't correct
2 Halted 0 ms 0 KB -