제출 #1170731

#제출 시각아이디문제언어결과실행 시간메모리
1170731JelalTkmKoala Game (APIO17_koala)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "koala.h"
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

using namespace std;

// #define int long long int

// const int N = 1e6 + 10;
// const int md = 1e9 + 7;
// const int INF = 1e18;

int minValue(int n, int w) {
  vector<int> v(n), a(n);
  v[0] = 1;
  playRound(v, a);
  for (int i = 0; i < N; i++)
    if (a[i] == 0) return i;
  return 0;
}

int maxValue(int n, int w) {
  vector<int> a(n, 1);
  int cnt = 100, ans = 0, t = 1;
  while (cnt != 1) {
    vector<int> v(n);
    for (int i = 0; i < n; i++)
      if (a[i] == t) v[i] = t, ans = i;
    playRound(v, a);
    t++; cnt = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] == t) {
        ans = i;
        cnt++;
      }
    }
  }

  return ans;
}

int greaterValue(int n, int w) {
  return 0;
}

void allValues(int n, int w, int *p) {
  return;
}

// int32_t main(int32_t argc, char *argv[]) {
//   ios::sync_with_stdio(false);
//   cin.tie(nullptr);

//   int T = 1;
//   // cin >> T;
//   while (T--) {
    
//   }

//   return 0;
// }

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

koala.cpp: In function 'int minValue(int, int)':
koala.cpp:17:13: error: cannot convert 'std::vector<int>' to 'int*'
   17 |   playRound(v, a);
      |             ^
      |             |
      |             std::vector<int>
In file included from koala.cpp:2:
koala.h:4:21: note:   initializing argument 1 of 'void playRound(int*, int*)'
    4 | void playRound(int *B, int *R);
      |                ~~~~~^
koala.cpp:18:23: error: 'N' was not declared in this scope
   18 |   for (int i = 0; i < N; i++)
      |                       ^
koala.cpp: In function 'int maxValue(int, int)':
koala.cpp:30:15: error: cannot convert 'std::vector<int>' to 'int*'
   30 |     playRound(v, a);
      |               ^
      |               |
      |               std::vector<int>
In file included from koala.cpp:2:
koala.h:4:21: note:   initializing argument 1 of 'void playRound(int*, int*)'
    4 | void playRound(int *B, int *R);
      |                ~~~~~^