답안 #944090

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
944090 2024-03-12T08:23:40 Z Boycl07 코알라 (APIO17_koala) C++17
컴파일 오류
0 ms 0 KB
#include "koala.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 1; (i) <= (n); ++i)
#define forn(i, l, r) for(int i = (l); i <= (r); ++i)
#define ford(i, r, l) for(int i = (r); i >= (l); --i)
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define FORD(i, n) for(int i = ((n) - 1); i >= 0; --i)

mt19937 rng(192929);
const int MaxN = 2e5 + 3;
int b[MaxN], r[MaxN];

int minValue(int N, int W) {
    int x = rng() % N;
    b[x] = 1;
    playRound(b, r);
    int pos_x = 0;
    while(r[pos_x]) ++pos_x;
    for(int i = 0; i < N; ++i) if(r[i] == 2) return pos_x;
    int y = rng() % N ;
    b[x] = 0;
    b[y] = 1;
    playRound(b, r);
    int pos_y;
    while(r[pos_y]) ++pos_y;
    for(int i = 0; i < N; ++i) if(r[i] == 2) return pos_y;
    if(pos_x == pos_y) return pos_x;

    return (rng() & 1) ? pos_x : pos_y;
}

Compilation message

koala.cpp: In function 'int minValue(int, int)':
koala.cpp:29:9: warning: 'pos_y' may be used uninitialized in this function [-Wmaybe-uninitialized]
   29 |     int pos_y;
      |         ^~~~~
/usr/bin/ld: /tmp/ccHmTIrA.o: in function `runGame(int)':
grader.cpp:(.text+0x191): undefined reference to `allValues(int, int, int*)'
/usr/bin/ld: grader.cpp:(.text+0x1d7): undefined reference to `maxValue(int, int)'
/usr/bin/ld: grader.cpp:(.text+0x207): undefined reference to `greaterValue(int, int)'
collect2: error: ld returned 1 exit status