Submission #650666

# Submission time Handle Problem Language Result Execution time Memory
650666 2022-10-14T15:09:33 Z Pety Koala Game (APIO17_koala) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "koala.h"

#define ll long long

using namespace std;

const int INF = 1e9;
const int MOD = 1e9 + 7;

int t, a[200002];

int greaterValue(int n, int w) {
  vector<int>q(n);
  int st = 1, dr = 7;
  while (st <= dr) {
    int mid = (st + dr) / 2;
    vector<int>R(n);
    q[0] = q[1] = mid;
    playRound(q, R); 
    if (R[0] != R[1])
      return R[0] < R[1]; 
    if (!R[0])
      dr = mid - 1;
    else
      st = mid + 1;
  }
  return 0;
}


int main () 
{
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
    }
    int msk = (1 << 30) - 1;
    while (msk) {
      int mx = 0, poz = 0;
      for (int i = 1; i <= n; i++) {
        if (a[i] != -1)
          if (i == 1 || (mx < (a[i] & msk))) {
            poz = i;
            mx = (a[i] & msk);
          }
      }
      if (mx == 0)
        break;
      cout << a[poz] << " ";
      msk = msk - (msk & a[poz]);
      a[poz] = -1;
      
    }
    for (int i = 1; i <= n; i++)
      if (a[i] != -1) {
        cout << a[i] << " ";
      }
    cout << "\n";
  }
  
  return 0;
}

Compilation message

koala.cpp: In function 'int greaterValue(int, int)':
koala.cpp:20:15: error: cannot convert 'std::vector<int>' to 'int*'
   20 |     playRound(q, R);
      |               ^
      |               |
      |               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);
      |                ~~~~~^