제출 #471997

#제출 시각아이디문제언어결과실행 시간메모리
471997nicholask저울 (IOI15_scales)C++14
컴파일 에러
0 ms0 KiB
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
void init(int T){}
int r1,r2;
void orderCoins() {
	vector <int> ans;
	r1=getHeaviest(1,2,3);
	r2=getLightest(1,2,3);
	ans.push_back(r2);
	ans.push_back(6-r1-r2);
	ans.push_back(r1);
	r1=getNextLightest(ans[0],ans[1],ans[2],4);
	if (r1==ans[0]){
		r1=getLightest(4,ans[0],ans[1]);
		if (r1==4) ans.insert(ans.begin(),4);
		else ans.push_back(4);
	} else if (r1==ans[1]){
		ans.insert(ans.begin()+1,4);
	} else {
		ans.insert(ans.begin()+2,4);
	}
	r1=getNextLightest(ans[0],ans[2],ans[3],5);
	if (r1==ans[0]){
		r1=getLighest(5,ans[0],ans[1]);
		if (r1==5) ans.insert(ans.begin(),5);
		else ans.push_back(5);
	} else if (r1==ans[2]){
		r1=getLightest(5,ans[1],ans[2]);
		if (r1==5) ans.insert(ans.begin()+1,5);
		else ans.insert(ans.begin()+2,5);
	} else {
		ans.insert(ans.begin()+3,5);
	}
	r1=getNextLightest(ans[0],ans[2],ans[4]);
	if (r1==ans[0]){
		r1=getLightest(6,ans[0],ans[1]);
		if (r1==6) ans.insert(ans.begin(),6);
		else ans.push_back(6);
	} else if (r1==ans[2]){
		r1=getLightest(6,ans[1],ans[2]);
		if (r1==6) ans.insert(ans.begin()+1,6);
		else ans.insert(ans.begin()+2,6);
	} else {
		r1=getLightest(6,ans[3],ans[4]);
		if (r1==6) ans.insert(ans.begin()+3,6);
		else ans.insert(ans.begin()+4,6);
	}
	int W[6];
	for (int i=0; i<6; i++) W[i]=ans[i];
	answer(W);
}

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

scales.cpp: In function 'void init(int)':
scales.cpp:4:15: warning: unused parameter 'T' [-Wunused-parameter]
    4 | void init(int T){}
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:25:6: error: 'getLighest' was not declared in this scope; did you mean 'getLightest'?
   25 |   r1=getLighest(5,ans[0],ans[1]);
      |      ^~~~~~~~~~
      |      getLightest
scales.cpp:35:41: error: too few arguments to function 'int getNextLightest(int, int, int, int)'
   35 |  r1=getNextLightest(ans[0],ans[2],ans[4]);
      |                                         ^
In file included from scales.cpp:1:
scales.h:15:5: note: declared here
   15 | int getNextLightest(int A, int B, int C, int D);
      |     ^~~~~~~~~~~~~~~