제출 #619786

#제출 시각아이디문제언어결과실행 시간메모리
619786amin저울 (IOI15_scales)C++14
컴파일 에러
0 ms0 KiB
#include "scales.h"

void init(int T) {
    /* ... */
}

void orderCoins() {
    /* ... */
    int W[] = {1, 2, 3, 4, 5, 6};
    long o=getLightest(1,2,3);
    long oo=getLightest(4,5,6);
    swap(W[0],W[o-1]);
    swap(W[3],W[oo-1]);
    vector<long>ans;
    o=getLightest(W[0],W[1],W[3]);
    vector<long>v;
    ans.push_back(o);
    if(W[3]==o)
    {
        swap(W[0],W[3]);
        swap(W[1],W[4]);
        swap(W[2],W[5]);
    }
    long k=getLightest(W[2],W[3],W[4]);
    ans.push_back(k);
    for(long i=0;i<6;i++)
    {
        if(W[i]==k||W[i]==o)
        {
            v.push_back(W[i]);
        }
    }
    long x=getLightest(v[0],v[1],getMedian(v[2],v[3],ans[0]));
    for(long i=0;i<4;i++)
    {
        if(v[i]==x)
        {
            v.erase(v.begin()+i);
        }
    }
    ans.push_back(x);
    o=getLightest(v[0],v[1],v[2]);
    oo=getMedian(v[0],v[1],v[2]);
        ans.push_back(o);
    ans.push_back(oo);
    for(long i=0;i<3;i++)
    {
        if(v[i]!=o&&v[i]!=oo)
        {
            ans.push_back(v[i]);
            break;
        }
    }

    for(long i=0;i<6;i++)
    {
        W[i]=ans[i];
    }
    answer(W);
}

컴파일 시 표준 에러 (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:5: error: 'swap' was not declared in this scope
   12 |     swap(W[0],W[o-1]);
      |     ^~~~
scales.cpp:14:5: error: 'vector' was not declared in this scope
   14 |     vector<long>ans;
      |     ^~~~~~
scales.cpp:14:12: error: expected primary-expression before 'long'
   14 |     vector<long>ans;
      |            ^~~~
scales.cpp:16:12: error: expected primary-expression before 'long'
   16 |     vector<long>v;
      |            ^~~~
scales.cpp:17:5: error: 'ans' was not declared in this scope
   17 |     ans.push_back(o);
      |     ^~~
scales.cpp:30:13: error: 'v' was not declared in this scope
   30 |             v.push_back(W[i]);
      |             ^
scales.cpp:33:24: error: 'v' was not declared in this scope
   33 |     long x=getLightest(v[0],v[1],getMedian(v[2],v[3],ans[0]));
      |                        ^