제출 #396995

#제출 시각아이디문제언어결과실행 시간메모리
396995Andyvanh1저울 (IOI15_scales)C++14
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #include <algorithm> #include <set> using namespace std; typedef long long ll; typedef vector<int> vi; #define vt vector int getHeaviest(int a, int b, int c){ } int getLightest(int a, int b, int c){ } int getNextLightest(int a, int b, int c, int d){ } void orderCoins(){ vi arr1(3); vi arr2(3); int x = getHeaviest(1,2,3); if(x==3){ arr1[2] = 3; }else if(x==2){ arr1[2] = 2; }else{ arr1[2] = 1; } int y = getLightest(1,2,3); if(y==3){ arr1[0] = 3; }else if(y==2){ arr1[0] = 2; }else{ arr1[0] = 1; } arr1[1] = 6-arr1[0]-arr1[2]; x = getHeaviest(4,5,6); if(x==4){ arr2[2] = 4; }else if(x==5){ arr2[2] = 5; }else{ arr2[2] = 6; } y = getLightest(4,5,6); if(y==4){ arr2[0] = 4; }else if(y==5){ arr2[0] = 5; }else{ arr2[0] = 6; } arr2[1] = 15-arr2[0]-arr2[2]; x = getHeaviest(arr1[0],arr1[2],arr2[2]); vi ans(6); for(int i = 0; i< 6; i++){ ans[i] =-1; } if(x==arr2[2]) { swap(arr1, arr2); } x = getNextLightest(arr1[0],arr1[1],arr1[2],arr2[0]); if(x==arr1[0]){ ans[arr2[0]-1]=0; }else if(x==arr1[1]){ ans[arr2[0]-1]=1; }else{ ans[arr2[0]-1]=2; } x = getNextLightest(arr1[0],arr1[1],arr1[2],arr2[1]); if(x==arr1[0]){ ans[arr2[1]-1]=1; }else if(x==arr1[1]){ ans[arr2[1]-1]=2; }else{ ans[arr2[1]-1]=3; } x = getNextLightest(arr1[0],arr1[1],arr1[2],arr2[2]); if(x==arr1[0]){ ans[arr2[2]-1]=2; }else if(x==arr1[1]){ ans[arr2[2]-1]=3; }else{ ans[arr2[2]-1]=4; } set<int> vals; for(int i = 0; i < 6; i++){ vals.insert(i); } for(int i = 0; i < 3; i++){ vals.erase(vals.find(ans[arr2[i]-1])); } int index = 0; for(auto it = vals.begin();it!=vals.end(); it++ ){ ans[arr1[index]-1] = *it; index++; } int reans[6]; for(int i = 0; i < 6; i++){ reans[ans[i]]=i; } answer(reans); return; } void init(int T){ }

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

scales.cpp: In function 'int getHeaviest(int, int, int)':
scales.cpp:16:1: warning: no return statement in function returning non-void [-Wreturn-type]
   16 | }
      | ^
scales.cpp:14:21: warning: unused parameter 'a' [-Wunused-parameter]
   14 | int getHeaviest(int a, int b, int c){
      |                 ~~~~^
scales.cpp:14:28: warning: unused parameter 'b' [-Wunused-parameter]
   14 | int getHeaviest(int a, int b, int c){
      |                        ~~~~^
scales.cpp:14:35: warning: unused parameter 'c' [-Wunused-parameter]
   14 | int getHeaviest(int a, int b, int c){
      |                               ~~~~^
scales.cpp: In function 'int getLightest(int, int, int)':
scales.cpp:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
scales.cpp:17:21: warning: unused parameter 'a' [-Wunused-parameter]
   17 | int getLightest(int a, int b, int c){
      |                 ~~~~^
scales.cpp:17:28: warning: unused parameter 'b' [-Wunused-parameter]
   17 | int getLightest(int a, int b, int c){
      |                        ~~~~^
scales.cpp:17:35: warning: unused parameter 'c' [-Wunused-parameter]
   17 | int getLightest(int a, int b, int c){
      |                               ~~~~^
scales.cpp: In function 'int getNextLightest(int, int, int, int)':
scales.cpp:22:1: warning: no return statement in function returning non-void [-Wreturn-type]
   22 | }
      | ^
scales.cpp:20:25: warning: unused parameter 'a' [-Wunused-parameter]
   20 | int getNextLightest(int a, int b, int c, int d){
      |                     ~~~~^
scales.cpp:20:32: warning: unused parameter 'b' [-Wunused-parameter]
   20 | int getNextLightest(int a, int b, int c, int d){
      |                            ~~~~^
scales.cpp:20:39: warning: unused parameter 'c' [-Wunused-parameter]
   20 | int getNextLightest(int a, int b, int c, int d){
      |                                   ~~~~^
scales.cpp:20:46: warning: unused parameter 'd' [-Wunused-parameter]
   20 | int getNextLightest(int a, int b, int c, int d){
      |                                          ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:121:9: error: 'answer' was not declared in this scope
  121 |         answer(reans);
      |         ^~~~~~
scales.cpp: In function 'void init(int)':
scales.cpp:129:15: warning: unused parameter 'T' [-Wunused-parameter]
  129 | void init(int T){
      |           ~~~~^