제출 #520084

#제출 시각아이디문제언어결과실행 시간메모리
520084pisikaka저울 (IOI15_scales)C++17
컴파일 에러
0 ms0 KiB
#include "scales.h" void init(int T) { return; } void orderCoins() { int w[] = {1, 2, 3, 4, 5, 6}, ans[6]; for(int k = 0; k < 4; ++k){ for(int i = 0; i < 4; ++i){ int v = getLightest(w[i], w[i+1], w[i+2]); for(int j = i; j <= i+2; ++j) if(v == w[j]) swap(w[i], w[j]); v = getMedian(w[i], w[i+1], w[i+2]); for(int j = i; j <= i+2; ++j) if(v == w[j]) swap(w[i], w[j]); } } answer(w); return; }

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

scales.cpp: In function 'void init(int)':
scales.cpp:3:15: warning: unused parameter 'T' [-Wunused-parameter]
    3 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:12:53: error: 'swap' was not declared in this scope
   12 |         for(int j = i; j <= i+2; ++j) if(v == w[j]) swap(w[i], w[j]);
      |                                                     ^~~~
scales.cpp:14:53: error: 'swap' was not declared in this scope
   14 |         for(int j = i; j <= i+2; ++j) if(v == w[j]) swap(w[i], w[j]);
      |                                                     ^~~~
scales.cpp:8:35: warning: unused variable 'ans' [-Wunused-variable]
    8 |     int w[] = {1, 2, 3, 4, 5, 6}, ans[6];
      |                                   ^~~