제출 #1179057

#제출 시각아이디문제언어결과실행 시간메모리
1179057Ahmed_Kaaniche코알라 (APIO17_koala)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;
#define endl "\n"
#define ll long long
#define fi first
#define se second
#define pb push_back

ll cnt=0;

void playRound(vector<int> &b, vector<int> &r) {
    cnt++;
    for (auto &elt: b)
        cout << elt << ' ';
    cout << endl;
    
    for (auto &elt: r)
        cin >> elt;
}

int minValue(int N, int W) {
    vector<int> b(100, 0);
    vector<int> r(100);
    
    b[0] = 1;
    playRound(b, r);
    
    if (r[0] <= 1)
        return 0;
    else {
        for (int i = 0; i < N; ++i) {
            if (r[i] == 0)
                return i;
        }
    }
}

int maxValue(int N, int W) {

}

bool greaterValue(int N, int W) {

}

void allValues(int N, int W, vector<int> &P) {

}
void runGame(int x) {
    int f, g;
    cin >> f >> g;
    for (int i = 0; i < g; ++i) {
        int n, w;
        cin >> n >> w;
        vector<int> p(n);
        for (int j = 0; j < n; ++j) {
            cin >> p[i];
        }
        
        if (f == 1) {
            cnt=0;
            cout << cnt << endl << minValue(n,w) << endl;
        } else if (f == 2) {
            cnt=0;
            cout << cnt << endl << maxValue(n,w) << endl;
        } else if (f == 3) {
            cnt=0;
            cout << cnt << endl << greaterValue(n,w) << endl;
        } else if (f == 4) {
            cnt=0;
            vector<int>P(n);
            cout << cnt << endl;
            allValues(n,w,P);
            for(auto &elt : P)
                cout << elt << ' ';
            cout << endl;
        }
    }
}

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

koala.cpp: In function 'int maxValue(int, int)':
koala.cpp:41:1: warning: no return statement in function returning non-void [-Wreturn-type]
   41 | }
      | ^
koala.cpp: In function 'bool greaterValue(int, int)':
koala.cpp:45:1: warning: no return statement in function returning non-void [-Wreturn-type]
   45 | }
      | ^
koala.cpp: In function 'int minValue(int, int)':
koala.cpp:37:1: warning: control reaches end of non-void function [-Wreturn-type]
   37 | }
      | ^
/usr/bin/ld: /tmp/ccJUU3RL.o: in function `runGame(int)':
grader.cpp:(.text+0x191): undefined reference to `allValues(int, int, int*)'
collect2: error: ld returned 1 exit status