Submission #1170740

#TimeUsernameProblemLanguageResultExecution timeMemory
1170740JelalTkmKoala Game (APIO17_koala)C++20
Compilation error
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) {
  int v[N], a[N];
  for (int i = 0; i < N; i++)
    v[i] = a[i] = 0;
  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) {
  int a[N];
  for (int i = 0; i < N; i++)
    a[i] = 1;
  int cnt = 100, ans = 0, t = 1;
  while (cnt != 1) {
    int v[N];
    for (int i = 0; i < n; i++) 
      if (a[i] == t) v[i] = t, ans = i;
      else v[i] = 0;
    for (int i = 0; i < n; i++)
      a[i] = 0;
    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;
// }

Compilation message (stderr)

koala.cpp: In function 'int maxValue(int, int)':
koala.cpp:26:9: error: 'N' was not declared in this scope
   26 |   int a[N];
      |         ^
koala.cpp:28:5: error: 'a' was not declared in this scope
   28 |     a[i] = 1;
      |     ^
koala.cpp:33:11: error: 'a' was not declared in this scope
   33 |       if (a[i] == t) v[i] = t, ans = i;
      |           ^
koala.cpp:33:22: error: 'v' was not declared in this scope
   33 |       if (a[i] == t) v[i] = t, ans = i;
      |                      ^
koala.cpp:34:12: error: 'v' was not declared in this scope
   34 |       else v[i] = 0;
      |            ^
koala.cpp:36:7: error: 'a' was not declared in this scope
   36 |       a[i] = 0;
      |       ^
koala.cpp:37:15: error: 'v' was not declared in this scope
   37 |     playRound(v, a);
      |               ^
koala.cpp:37:18: error: 'a' was not declared in this scope
   37 |     playRound(v, a);
      |                  ^