제출 #128059

#제출 시각아이디문제언어결과실행 시간메모리
128059SortingScales (IOI15_scales)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; void answer(int *W); int getHeaviest(int A, int B, int C); int getLightest(int A, int B, int C); int getMedian(int A, int B, int C); int getNextLightest(int A, int B, int C, int D); void init(int t){ } vector<int> other(vector<int> v){ vector<int> ans; for(int i = 1; i <= 6; i++){ bool ok = true; for(int x: v){ if(x == i){ ok = false; } } if(ok){ ans.push_back(i); } } return ans; } void erase(vector<int> &a, int x){ for(int i = 0; i < (int)a.size(); i++){ if(a[i] == x){ for(int j = i; j < (int)a.size() - 1; j++){ a[j] = a[j + 1]; } a.pop_back(); return; } } } int ans[6]; void orderCoins(){ vector<int> a = {1, 2, 3, 4, 5, 6}; int c1 = getLightest(1, 2, 3); int c2 = getLightest(4, 5, 6); int c3 = getLightest(c1, c2, other(vector<int>{c1, c2})[0]); ans[0] = c3; erase(a, c3); int c4, c5; if(c3 == c1){ vector<int> v; for(int i = 1; i <= 4; i++){ if(c1 == i){ continue; } v.push_back(i); } c4 = getLightest(v[0], v[1], v[2]); c5 = c2; } else{ vector<int> v; for(int i = 3; i <= 6; i++){ if(c2 == i){ continue; } v.push_back(i); } c4 = getLightest(v[0], v[1], v[2]); c5 = c1; } int c6 = getLightest(c4, c5, other(vector<int>{c4, c5, c3})[0]); ans[1] = c6; int c7 = c4 + c5 - c6; vector<int> v1 = other(vector<int>{c4, c5, c3}); int c8 = getLightest(v1[0], v1[1], v1[2]); int c9 = getLightest(c8, c7, other(vector<int>{c4, c5, c3, c8})[0]); ans[2] = c9; vector<int> v2 = other(vector<int>{c3, c6, c9}); int c10 = getLightest(v2[0], v2[1], v2[2]); int c11 = getHeaviest(v2[0], v2[1], v2[2]); ans[3] = c10; ans[5] = c11; ans[4] = v2[0] + v2[1] + v2[2] - c10 - c11; answer(ans); }

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

scales.cpp: In function 'void init(int)':
scales.cpp:11:15: warning: unused parameter 't' [-Wunused-parameter]
 void init(int t){
               ^
/tmp/cccT16FB.o: In function `main':
grader.c:(.text.startup+0x76): undefined reference to `init'
grader.c:(.text.startup+0xe1): undefined reference to `orderCoins'
/tmp/cc7vhtvb.o: In function `orderCoins()':
scales.cpp:(.text+0x210): undefined reference to `getLightest(int, int, int)'
scales.cpp:(.text+0x226): undefined reference to `getLightest(int, int, int)'
scales.cpp:(.text+0x290): undefined reference to `getLightest(int, int, int)'
scales.cpp:(.text+0x33b): undefined reference to `getLightest(int, int, int)'
scales.cpp:(.text+0x3ca): undefined reference to `getLightest(int, int, int)'
/tmp/cc7vhtvb.o:scales.cpp:(.text+0x487): more undefined references to `getLightest(int, int, int)' follow
/tmp/cc7vhtvb.o: In function `orderCoins()':
scales.cpp:(.text+0x5c5): undefined reference to `getHeaviest(int, int, int)'
scales.cpp:(.text+0x5f2): undefined reference to `answer(int*)'
scales.cpp:(.text+0x6b6): undefined reference to `getLightest(int, int, int)'
collect2: error: ld returned 1 exit status