제출 #364972

#제출 시각아이디문제언어결과실행 시간메모리
364972rocks03저울 (IOI15_scales)C++14
컴파일 에러
0 ms0 KiB
//#pragma GCC target("avx2") //#pragma GCC optimization("O3") //#pragma GCC optimization("unroll-loops") #include<bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define ff first #define ss second #define pb push_back #define SZ(x) ((int)(x).size()) #define all(x) x.begin(), x.end() #define rep(i, a, b) for(int i = (a); i < (b); i++) #define Re(i, a, b) for(int i = (a); i >= (b); i--) int solution[6]; 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); void init(int T){ } void answer(int []); void ordina3(int& x, int& y, int& z){ int c = getHeaviest(x, y, z); int a = getLightest(x, y, z); int b; int arr[] = {x, y, z}; for(int i = 0; i < 3; i++){ if(a != arr[i] && c != arr[i]) b = arr[i]; } x = a, y = b, z = c; } void orderCoins(){ for(int i = 0; i < 6; i++){ solution[i] = i + 1; } ordina3(solution[0], solution[1], solution[2]); ordina3(solution[3], solution[4], solution[5]); vector<int> my_ans; int l = 0, r = 3; while(1){ if(2 - l + 1 + 5 - r + 1 == 3){ for(int i = 0; i < 6; i++){ if(l <= i && i <= 2){ my_ans.pb(solution[i]); } if(r <= i && i <= 5){ my_ans.pb(solution[i]); } } ordina3(my_ans[3], my_ans[4], my_ans[5]); break; } if(l + 1 <= 2){ int x1 = solution[l], x2 = solution[l + 1], x3 = solution[r]; int x = getLightest(x1, x2, x3); if(x1 == x){ my_ans.pb(solution[l++]); } else if(x3 == x){ my_ans.pb(solution[r++]); } } else if(r + 1 <= 5){ int x1 = solution[l], x2 = solution[r], x3 = solution[r + 1]; int x = getLightest(x1, x2, x3); if(x1 == x){ my_ans.pb(solution[l++]); } else if(x2 == x){ my_ans.pb(solution[r++]); } } else assert(false); } for(int i = 0; i < 6; i++){ solution[i] = my_ans[i]; } answer(solution); }

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

scales.cpp: In function 'void init(int)':
scales.cpp:27:15: warning: unused parameter 'T' [-Wunused-parameter]
   27 | void init(int T){
      |           ~~~~^
scales.cpp: In function 'void ordina3(int&, int&, int&)':
scales.cpp:41:14: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
   41 |     x = a, y = b, z = c;
      |            ~~^~~
/tmp/cckWGKGa.o: In function `ordina3(int&, int&, int&)':
scales.cpp:(.text+0x3c): undefined reference to `getHeaviest(int, int, int)'
scales.cpp:(.text+0x4d): undefined reference to `getLightest(int, int, int)'
/tmp/cckWGKGa.o: In function `orderCoins()':
scales.cpp:(.text+0x197): undefined reference to `getLightest(int, int, int)'
scales.cpp:(.text+0x1e6): undefined reference to `getLightest(int, int, int)'
scales.cpp:(.text+0x2d9): undefined reference to `answer(int*)'
/tmp/ccNOrdtf.o: In function `main':
grader.c:(.text.startup+0x79): undefined reference to `init'
grader.c:(.text.startup+0xf2): undefined reference to `orderCoins'
collect2: error: ld returned 1 exit status