제출 #668823

#제출 시각아이디문제언어결과실행 시간메모리
668823Astrayt저울 (IOI15_scales)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define All(x) x.begin(), x.end()

vector<int> adj[6];
int t, deg[6], arr[6];

void init(int T){
	t = T;
	for(int i = 0; i < 6; ++i) deg[i] = 0;
}

void orderCoins(){
	for(int i = 0; i < 6; ++i){
		adj[i].clear();
	}
	for(int i = 0; i < 6; ++i){
		for(int j = i + 1; j < 6; ++j){
			for(int k = j + 1; k < 6; ++k){
				int a = getHeaviest(i, j, k), b = getMedium(i, j, k), c;
				if(a == i && b == j || a == j && b == i) c = k;
				else if(a == i && b == k || a == k && b == i) c = j;
				else c = i;
				adj[a].pb(b), adj[b].pb(c);
				deg[b]++, deg[c]++;
			}
		}
	}
	queue<int> bfs;
	vector<int> top;
	for(int i = 0; i < 6; ++i){
		if(deg[i] == 0) bfs.push(i);
	}
	while(bfs.size()){
		int u = bfs.front();
		bfs.pop();
		top.pb(u);
		for(auto v:adj[u]){
			deg[v]--;
			if(deg[v] == 0) bfs.push(v);
		}
	}
	reverse(top.begin(), top.end());
	int ans[6];
	for(int i = 0; i < 6; ++i) ans[i] = top[i] + 1;
	answer(ans);
	return;
}

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

scales.cpp: In function 'void orderCoins()':
scales.cpp:23:13: error: 'getHeaviest' was not declared in this scope
   23 |     int a = getHeaviest(i, j, k), b = getMedium(i, j, k), c;
      |             ^~~~~~~~~~~
scales.cpp:24:18: error: 'b' was not declared in this scope
   24 |     if(a == i && b == j || a == j && b == i) c = k;
      |                  ^
scales.cpp:24:46: error: 'c' was not declared in this scope
   24 |     if(a == i && b == j || a == j && b == i) c = k;
      |                                              ^
scales.cpp:25:51: error: 'c' was not declared in this scope
   25 |     else if(a == i && b == k || a == k && b == i) c = j;
      |                                                   ^
scales.cpp:26:10: error: 'c' was not declared in this scope
   26 |     else c = i;
      |          ^
scales.cpp:27:15: error: 'b' was not declared in this scope
   27 |     adj[a].pb(b), adj[b].pb(c);
      |               ^
scales.cpp:27:29: error: 'c' was not declared in this scope
   27 |     adj[a].pb(b), adj[b].pb(c);
      |                             ^
scales.cpp:49:2: error: 'answer' was not declared in this scope
   49 |  answer(ans);
      |  ^~~~~~