제출 #595599

#제출 시각아이디문제언어결과실행 시간메모리
595599Apiram저울 (IOI15_scales)C++14
컴파일 에러
0 ms0 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; void init(int T) { //1 2 3 4 5 6 // 5 - operations to get first and last value -> call median 4times then maximum or minimum 1 times // 2 - median call to get middle value // 2 call to do remaining // 9 calls to sort } //3 4 6 2 1 5 void orderCoins() { vector<int>ans = {1,2,3,4,5,6}; auto exchange = [&](int i,int j,int p,int q,int r){ for (auto x:{p,q,r}){ if (ans[x] == i)ans[x] = j; else if (ans[x] == j)ans[x] =i; } }; int a = getLightest(ans[0],ans[1],ans[2]); exchange(a,ans[0],0,1,2); a = getLightest(ans[0],ans[3],ans[4]); exchange(a,ans[0],0,3,4); a = getLightest(ans[0],ans[4],ans[5]); exchange(a,ans[0],0,4,5); a = getHighest(ans[1],ans[2],ans[3]); exchange(a,ans[5],1,2,3); a = getHighest(ans[3],ans[4],ans[5]); exchange(a,ans[5],3,4,5); a = getLightest(ans[1],ans[2],ans[3]); exchange(a,ans[1],1,2,3); a = getLightest(ans[1],ans[3],ans[4]); exchange(a,ans[1],1,3,4); a = getHighest(ans[2],ans[3],ans[4]); exchange(a,ans[4],2,3,4); a = getLightest(ans[2],ans[3],ans[4]); exchance(a,ans[2],2,3,4); answer(ans.data()); return; }

컴파일 시 표준 에러 (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:26:6: error: 'getHighest' was not declared in this scope; did you mean 'getLightest'?
   26 |  a = getHighest(ans[1],ans[2],ans[3]);
      |      ^~~~~~~~~~
      |      getLightest
scales.cpp:37:2: error: 'exchance' was not declared in this scope; did you mean 'exchange'?
   37 |  exchance(a,ans[2],2,3,4);
      |  ^~~~~~~~
      |  exchange