제출 #1367013

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()
#define endl '\n'


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

void orderCoins() {
    int W[] = {1, 2, 3, 4, 5, 6};
    vector<int> a, b;
    a.pb(getLightest(1, 2, 3));  
    a.pb(getMedian(1, 2, 3));  
    a.pb(getHeaviest(1, 2, 3));
    b.pb(getLightest(4, 5, 6));  
    b.pb(getMedian(4, 5, 6));  
    b.pb(getHeaviest(4, 5, 6));
    vector<int> s;
    while(min(sz(a), sz(b))>=1&&sz(a)+sz(b)>=3) {
        if(sz(a)<sz(b)) swap(a, b);
        auto it=getLightest(a[0], a[1], b[0]);
        s.pb(it);
        a.erase(find(all(a), it));
        b.erase(find(all(b), it));
    }
    if(sz(a)&&sz(b)) {
        auto it=getMedian(a[0], b[0], s.back());
        s.pb(it);
        a.erase(find(all(a), it));
        b.erase(find(all(b), it));
        if(sz(a)) s.pb(a.back());
        else s.pb(b.back());
    }
    else {
        reverse(all(a));
        reverse(all(b));
        while(sz(a)) s.pb(a.back()), a.pop_back();
        while(sz(b)) s.pb(b.back()), b.pop_back();
    }
    answer(s);
}
    

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

scales.cpp: In function 'void orderCoins()':
scales.cpp:50:12: error: cannot convert 'std::vector<int>' to 'int*'
   50 |     answer(s);
      |            ^
      |            |
      |            std::vector<int>
In file included from scales.cpp:1:
scales.h:10:17: note:   initializing argument 1 of 'void answer(int*)'
   10 | void answer(int W[]);
      |             ~~~~^~~