제출 #792140

#제출 시각아이디문제언어결과실행 시간메모리
792140NothingXD팀들 (IOI15_teams)C++17
컴파일 에러
0 ms0 KiB
#include "scales.h"
#include <bits/stdc++.h>

using namespace std;

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

void debug_out(){cerr << endl;}

template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T){
	cerr << H << ' ';
	debug_out(T...);
}

#define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define MP(x, y) make_pair(x, y)

vector<vector<int>> perm;
vector<vector<int>> query;

void init(int T) {
	for (int d = 0; d < 6; d++){
		for (int i = 0; i < 6; i++){
			for (int j = i+1; j < 6; j++){
				for (int k = j+1; k < 6; k++){
					if (i == d || j == d || k == d) continue;
					query.push_back({i, j, k, d});
				}
			}
		}
	}

	for (auto x: {-2, -3, -1}){
		for (int i = 0; i < 6; i++){
			for (int j = i+1; j < 6; j++){
				for (int k = j+1; k < 6; k++){
					query.push_back({i, j, k, x});
				}
			}
		}
	}
}

int get(vector<int> a, int x, int y, int z, int idx){
	if (perm.size() == 6) debug(x, y, z, idx);
	vector<int> tmp = {a[x], a[y], a[z]};
	sort(all(tmp));
	if (tmp[idx] == a[x]) return 0;
	if (tmp[idx] == a[y]) return 1;
	if (tmp[idx] == a[z]) return 2;
}

int getnext(vector<int> a, int x, int y, int z, int d){
	vector<int> tmp = {a[x], a[y], a[z]};
	sort(all(tmp));
	int idx = 0;
	for (int i = 0; i < 3; i++){
		if (tmp[i] > a[d]){
			idx = i;
			break;
		}
	}
	if (tmp[idx] == a[x]) return 0;
	if (tmp[idx] == a[y]) return 1;
	if (tmp[idx] == a[z]) return 2;
}

void solve(){
	//debug(perm.size());
	if (perm.size() == 6){
		for (auto x: perm){
			for (auto y: x) cerr << y << ' ';
			cerr << endl;
		}
	}
	if (perm.size() == 1) return;
	int mx = perm.size() + 1;
	vector<vector<int>> ans[3];
	vector<int> q;
	for (auto x: query){
		vector<vector<int>> res[3];
		for (auto y: perm){
			if (x[3] >= 0){
				int tmp = getnext(y, x[0], x[1], x[2], x[3]);
				res[tmp].push_back(y);
			}
			else{
				int tmp = get(y, x[0], x[1], x[2], -x[3] - 1);
				res[tmp].push_back(y);
			}
		}
		if (perm.size() == 6 && x[3] < 0){
		//	debug(x[0], x[1], x[2], x[3], res[0].size(), res[1].size(), res[2].size());
		}
		int tmp = max({res[0].size(), res[1].size(), res[2].size()});
		if (tmp < mx){
			mx = tmp;
			for (int i = 0; i < 3; i++){
				ans[i] = res[i];
			}
			q = x;
		}
	}
	assert(mx != perm.size());
	if (q[3] >= 0){
		int tmp = getNextLightest(q[0]+1, q[1]+1, q[2]+1, q[3]+1) - 1;
		for (int i = 0; i < 3; i++){
			if (tmp == q[i]) perm = ans[i];
		}
	}
	else{
		int tmp;
		switch(q[3]){
			case -1:
				tmp = getLightest(q[0]+1, q[1]+1, q[2]+1)-1;
				break;
			case -2:
				tmp = getMedian(q[0]+1, q[1]+1, q[2]+1)-1;
				break;
			case -3:
				tmp = getHeaviest(q[0]+1, q[1]+1, q[2]+1)-1;
				break;
		}
		for (int i = 0; i < 3; i++){
			if (tmp == q[i]) perm = ans[i];
		}
	}
	solve();
}

int cnt = 0;

void orderCoins() {
	cnt++;
	//debug(cnt);
	vector<int> tmp = {0, 1, 2, 3, 4, 5};

	perm.clear();
	
	do{
		perm.push_back(tmp);
	} while(next_permutation(all(tmp)));

	//debug(perm.size());

	solve();
	int ans[6];
	for (int i = 0; i < 6; i++) ans[perm[0][i]] = i+1;
	answer(ans);
}

컴파일 시 표준 에러 (stderr) 메시지

teams.cpp:1:10: fatal error: scales.h: No such file or directory
    1 | #include "scales.h"
      |          ^~~~~~~~~~
compilation terminated.