답안 #150419

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
150419 2019-09-01T08:22:07 Z ----MIT합격선----(#3601, maruii, Diuven, andy627) On the Grid (FXCUP4_grid) C++17
12 / 100
8 ms 384 KB
#include "grid.h"
#include <algorithm>
#include <iostream>
using namespace std;

int n;
vector<int> tmp, lis;

bool cmp(int i, int j){
	bool used[1010]={};
	for(int x:lis) used[x]=true, tmp.push_back(x);
	used[i] = used[j] = true;
	for(int k=0; k<n; k++) if(!used[k]) tmp.push_back(k);
	tmp.push_back(j);
	tmp.push_back(i);
	reverse(tmp.begin(), tmp.end());

	int x = PutDisks(tmp);
	swap(tmp[0], tmp[1]);
	int y = PutDisks(tmp);
	tmp.clear();
	return x<y;
}

std::vector<int> SortDisks(int N) {
	n=N;

	bool used[1010]={};
	vector<int> don, tmp, ans(n);

	for(int i=n; i>=1; i--){
		int x = -1, mx = 0;
		for(int j=0; j<n; j++){
			if(used[j]) continue;
			for(int x:don) tmp.push_back(x);
			for(int k=0; k<n; k++) if(k!=j && !used[k]) tmp.push_back(k);
			tmp.push_back(j);
			reverse(tmp.begin(), tmp.end());
			int now = PutDisks(tmp);
			if(mx<now) mx = now, x = j;
			tmp.clear();
		}
		don.push_back(x), ans[x]=i, used[x]=true;
	}

	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Incorrect 8 ms 344 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Incorrect 8 ms 344 KB Output isn't correct
10 Halted 0 ms 0 KB -