제출 #793517

#제출 시각아이디문제언어결과실행 시간메모리
793517Markynoodle저울 (IOI15_scales)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;


void init(int t){
    return;
}

int getLightest(int a, int b, int c){return 0;}
int getMedian(int a, int b, int c){return 0;}
int getHeaviest(int a, int b, int c){return 0;}
int getNextLightest(int a, int b, int c, int d){return 0;}

void ordercoins(){
    int one;
    int two;
    int three;
    int four;
    int five;
    int six;
    int one = getLightest(1, 2, 3);
    int two = getMedian(1, 2, 3);
    int three = 6 - one - two;
    int four = getLightest(4, 5, 6);
    int five = getMedian(4, 5, 6);
    int six = 15 - four - five;

    int ans[6] = {0,0,0,0,0,0};
    int nextlight = getNextLightest(two, four, five, one);
    if(nextlight == two){
        ans[0] = one;
        ans[1] = two;
        int med = getMedian(three, five, six);
        if(med == three){
            ans[4] = three;
            ans[5] = six;
            ans[3] = five;
            ans[2] = four;
        }
        if(med == five){
            int medd = getMedian(three, four, five);
            ans[2] = three;
            ans[3] = four;
            ans[4] = five;
            ans[5] = six;
            if(medd == three){
                ans[2] = four;
                ans[3] = three;
                ans[4] = five;
                ans[5] = six;
            }
        }
        if(med == six){
            ans[5] = three;
            ans[4] = six;
            ans[3] = five;
            ans[2] = four;
        }
    }
    if(nextlight == five){
        ans[0] = four;
        ans[1] = one;
        ans[2] = five;
        int med = getMedian(two, three, six);
        if(med == two){
            ans[3] = six;
            ans[4] = two;
            ans[5] = three;
        }
        if(med == three){
            ans[3] = two;
            ans[4] = three;
            ans[5] = six;
        }
        if(med == six){
            ans[3] = two;
            ans[4] = six;
            ans[5] = three;
        }
    }
    if(nextlight == four){
        ans[0] = one;
        ans[1] = four;
        int low = getLightest(two, three, five);
        if(low == two){
            ans[2] = two;
            int med = getMedian(three, five, six);
            if(med == three){
                ans[3] = five;
                ans[4] = three;
                ans[5] = six;
            }
            if(med == five){
                ans[3] = three;
                ans[4] = five;
                ans[5] = six;
            }
            if(med == six){
                ans[3] = five;
                ans[4] = six;
                ans[5] = three;
            }
        }
        if(low == five){
            ans[2] = five;
            int med = getMedian(two, three, six);
            if(med == two){
                ans[3] = six;
                ans[4] = two;
                ans[5] = three;
            }
            if(med == three){
                ans[3] = two;
                ans[4] = three;
                ans[5] = six;
            }
            if(med == six){
                ans[3] = two;
                ans[4] = six;
                ans[5] = three;
            }
        }
    }
    answer(ans);

}

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

scales.cpp: In function 'void init(int)':
scales.cpp:5:15: warning: unused parameter 't' [-Wunused-parameter]
    5 | void init(int t){
      |           ~~~~^
scales.cpp: In function 'int getLightest(int, int, int)':
scales.cpp:9:21: warning: unused parameter 'a' [-Wunused-parameter]
    9 | int getLightest(int a, int b, int c){return 0;}
      |                 ~~~~^
scales.cpp:9:28: warning: unused parameter 'b' [-Wunused-parameter]
    9 | int getLightest(int a, int b, int c){return 0;}
      |                        ~~~~^
scales.cpp:9:35: warning: unused parameter 'c' [-Wunused-parameter]
    9 | int getLightest(int a, int b, int c){return 0;}
      |                               ~~~~^
scales.cpp: In function 'int getMedian(int, int, int)':
scales.cpp:10:19: warning: unused parameter 'a' [-Wunused-parameter]
   10 | int getMedian(int a, int b, int c){return 0;}
      |               ~~~~^
scales.cpp:10:26: warning: unused parameter 'b' [-Wunused-parameter]
   10 | int getMedian(int a, int b, int c){return 0;}
      |                      ~~~~^
scales.cpp:10:33: warning: unused parameter 'c' [-Wunused-parameter]
   10 | int getMedian(int a, int b, int c){return 0;}
      |                             ~~~~^
scales.cpp: In function 'int getHeaviest(int, int, int)':
scales.cpp:11:21: warning: unused parameter 'a' [-Wunused-parameter]
   11 | int getHeaviest(int a, int b, int c){return 0;}
      |                 ~~~~^
scales.cpp:11:28: warning: unused parameter 'b' [-Wunused-parameter]
   11 | int getHeaviest(int a, int b, int c){return 0;}
      |                        ~~~~^
scales.cpp:11:35: warning: unused parameter 'c' [-Wunused-parameter]
   11 | int getHeaviest(int a, int b, int c){return 0;}
      |                               ~~~~^
scales.cpp: In function 'int getNextLightest(int, int, int, int)':
scales.cpp:12:25: warning: unused parameter 'a' [-Wunused-parameter]
   12 | int getNextLightest(int a, int b, int c, int d){return 0;}
      |                     ~~~~^
scales.cpp:12:32: warning: unused parameter 'b' [-Wunused-parameter]
   12 | int getNextLightest(int a, int b, int c, int d){return 0;}
      |                            ~~~~^
scales.cpp:12:39: warning: unused parameter 'c' [-Wunused-parameter]
   12 | int getNextLightest(int a, int b, int c, int d){return 0;}
      |                                   ~~~~^
scales.cpp:12:46: warning: unused parameter 'd' [-Wunused-parameter]
   12 | int getNextLightest(int a, int b, int c, int d){return 0;}
      |                                          ~~~~^
scales.cpp: In function 'void ordercoins()':
scales.cpp:21:9: error: redeclaration of 'int one'
   21 |     int one = getLightest(1, 2, 3);
      |         ^~~
scales.cpp:15:9: note: 'int one' previously declared here
   15 |     int one;
      |         ^~~
scales.cpp:22:9: error: redeclaration of 'int two'
   22 |     int two = getMedian(1, 2, 3);
      |         ^~~
scales.cpp:16:9: note: 'int two' previously declared here
   16 |     int two;
      |         ^~~
scales.cpp:23:9: error: redeclaration of 'int three'
   23 |     int three = 6 - one - two;
      |         ^~~~~
scales.cpp:17:9: note: 'int three' previously declared here
   17 |     int three;
      |         ^~~~~
scales.cpp:24:9: error: redeclaration of 'int four'
   24 |     int four = getLightest(4, 5, 6);
      |         ^~~~
scales.cpp:18:9: note: 'int four' previously declared here
   18 |     int four;
      |         ^~~~
scales.cpp:25:9: error: redeclaration of 'int five'
   25 |     int five = getMedian(4, 5, 6);
      |         ^~~~
scales.cpp:19:9: note: 'int five' previously declared here
   19 |     int five;
      |         ^~~~
scales.cpp:26:9: error: redeclaration of 'int six'
   26 |     int six = 15 - four - five;
      |         ^~~
scales.cpp:20:9: note: 'int six' previously declared here
   20 |     int six;
      |         ^~~
scales.cpp:124:5: error: 'answer' was not declared in this scope
  124 |     answer(ans);
      |     ^~~~~~