Submission #205166

# Submission time Handle Problem Language Result Execution time Memory
205166 2020-02-28T08:43:20 Z theStaticMind Library (JOI18_library) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)((x).size())
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
//#define int long long int
using namespace std;

#include<library.h>

vector<int> Q(1001, 0);
int ind = 0;
int n;

vector<int> adj[1001];

int bin(int l, int r){
      int ret = -1;
      while(l <= r){
            int mid = (l + r) / 2;

            vector<int> arr(n, 0);

            for(int i = 0; i <= mid; i++)arr[i] = 1;
            arr[r + 1] = 1;

            if(Query(arr) == Q[mid]){
                  ret = mid;
                  r = mid - 1;
            }
            else{
                  l = mid + 1;
            }
      }
      return ret;
}

void Solve(int N){
      n = N;
      vector<int> arr(n, 0);

      for(;ind < n; ind++){
            arr[ind] = 1;
            int Q[ind] = Query(arr);
            if(ind != 0 && Q[ind] == Q[ind - 1]){
                  int x = bin(0, ind - 1);
                  adj[x].pb(ind);
                  adj[ind].pb(x);
                  x = bin(x + 1, ind - 1);
                  if(x != -1){
                        adj[x].pb(ind);
                        adj[ind].pb(x);
                  }
            }
      }

      int root = 0;
      while(sz(adj[root]) == 2)root++;

      vector<int> ans;
      int x = root;
      for(int i = 0; i < n; i++){
            if(adj[x].size() == 1){
                  ans.pb(x);
                  x = adj[x][0];
            }
            else{
                  if(ans.back() == adj[x][0]){
                        ans.pb(x);
                        x = adj[x][1];
                  }
                  else{
                        ans.pb(x);
                        x = adj[x][0];
                  }
            }
      }
      Answer(ans);
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:47:31: error: array must be initialized with a brace-enclosed initializer
             int Q[ind] = Query(arr);
                          ~~~~~^~~~~