제출 #595557

#제출 시각아이디문제언어결과실행 시간메모리
595557Apiram저울 (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 // 3 call to do remaining // 10 calls to sort } void orderCoins() { vector<bool>got(7,false); int a = getMedian(1, 2, 3); got[a] = true; a = getMedian(4,5,6); got[a] = true; for (int j = 0;j<2;++j){ vector<int>cur; for (int i = 1;i<7;++i){ if (!got[i]){ cur.push_back(i); } } a = getMedian(cur[0],cur[1],cur[2]); got[a] = true; } vector<int>cur; for (int i = 1;i<7;++i){ if (!got[a]){ cur.push_back(a); } } a = getHeaviest(cur[0],cur[1],a); vector<int>ans(6); ans[0] = a; if (a == cur[0]){ ans[5] = cur[1]; } else{ ans[5] = cur[0]; } cur.clear(); for (int i = 1;i<7;++i){ if (got[i])cur.push_back(i); } int b = getMedian(cur[0],cur[1],cur[2]); a = getMedian(b,cur[3],ans[5]); ans[3] = a; got[a] = false; cur.clear(); for (int i = 1;i<7;++i){ if (!got[i])cur.push_back(i); } a = getHeaviest(cur[0],cur[1],cur[2]); ans[4] = a; got[a] = true; a = getMedian(cur[0],cur[1],cur[2]); got[a] = true; ans[2] = a; for (int i = 1;i<6;++i){ if(!got[i])ans[1] = i; } answer(ans); 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:63:9: error: cannot convert 'std::vector<int>' to 'int*'
   63 |  answer(ans);
      |         ^~~
      |         |
      |         std::vector<int>
In file included from scales.cpp:1:
scales.h:10:17: note:   initializing argument 1 of 'void answer(int*)'
   10 | void answer(int W[]);
      |             ~~~~^~~