제출 #914274

#제출 시각아이디문제언어결과실행 시간메모리
914274Itamar저울 (IOI15_scales)C++14
컴파일 에러
0 ms0 KiB
void init(int T) { } #include "scales.h" #include <vector> using namespace std; #define vi vector<int> #include <set> #include <algorithm> void orderCoins() { vi vec = { 1,2,3 }; vi v; v.push_back(getLightest(1, 2, 3)); swap(vec[v[0]-1], vec.back()); vec.pop_back(); vec.push_back(4); int a = getHeaviest(4, vec[1], vec[0]); if (a == 4) { if (getHeaviest(v[0], vec[0], vec[1]) == vec[0]) { v = { v[0],vec[1],vec[0],vec[2] }; } else { v = { v[0],vec[0],vec[1],vec[2] }; } } else{ if (a == vec[0])swap(vec[1], vec[0]); v.push_back(vec[0]); v.push_back(vec[1]); int b = getMedian(v[1], v[0], vec[2]); int in; if (b == v[0])in = 0; else if (b == v[1])in = 2; else in = 1; vi vt; int i = 4; for (int j = 0; j < in; j++)vt.push_back(v[j]); vt.push_back(i); for (int j = in; j < i - 1; j++)vt.push_back(v[j]); v = vt; } for (int i = 5; i <= 6; i++) { vi vt; int an = getMedian(v[1], v[2], i); int in; if (an == i) { in = 2; } else if(an==v[1]) { int ant = getMedian(v[0], v[1], i); if (ant == v[0]) { in = 0; } else in = 1; } else { int ant = getMedian(v[i - 3], v[i - 2], i); if (ant == i)in = i - 2; else if (ant == v[i - 2])in = i - 1; else in = i - 3; } for (int j = 0; j < in; j++)vt.push_back(v[j]); vt.push_back(i); for (int j = in; j < i-1; j++)vt.push_back(v[j]); v = vt; } int c[6]; for (int i = 0; i < 6; i++)c[i] = v[i]; answer(c); }

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

scales.cpp: In function 'void init(int)':
scales.cpp:1:15: warning: unused parameter 'T' [-Wunused-parameter]
    1 | void init(int T) {
      |           ~~~~^
In file included from scales.cpp:4:
scales.h: At global scope:
scales.h:8:6: error: conflicting declaration of 'void init(int)' with 'C' linkage
    8 | void init(int T);
      |      ^~~~
scales.cpp:1:6: note: previous declaration with 'C++' linkage
    1 | void init(int T) {
      |      ^~~~