Submission #465480

# Submission time Handle Problem Language Result Execution time Memory
465480 2021-08-16T08:15:23 Z BT21tata ICC (CEOI16_icc) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "icc.h"
// #pragma GCC target ("avx,avx2,fma")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef long double ld;
#define SPEED ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0)
#define rall(v) (v).rbegin(),(v).rend()
#define all(v) (v).begin(),(v).end()
#define OK cerr<<"OK"<<endl<<flush
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define F first
#define S second
#define y0 jahdakdh
#define y1 jahsadakdakdh
#define endl '\n'
const ll MOD=1e9+7;
using namespace std;
//mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());

bool e[105][105];

int bs(int x, int n)
{
    vector<int>v;
    for(int i=x+1; i<=n; i++)
        if(!e[x][i]) v.pb(i);
    int l=0, r=v.size()-1, mid;
    while(l<r)
    {
        mid=(l+r)>>1;
        int b[n], pos=0;
        for(int i=l; i<=mid; i++)
            b[pos++]=v[i];
        bool f=query(1, mid-l+1, {x}, b);
        if(f) r=mid;
        else l=mid+1;
    }
    return v[l];
}

void run(int n)
{
    for(int cnt=1; cnt<n; cnt++)
    {
        for(int i=1; i<=n; i++)
        {
            int numb=0, b[n];
            for(int j=i+1; j<=n; j++)
                if(!e[i][j]) b[numb++]=j;
            if(!numb) continue;
            
            bool f=query(1, numb, {i}, b);
            if(f)
            {
                int x=bs(i, n);
                setRoad(i, x);
                e[i][x]=e[x][i]=1;
            }
        }
    }

}

Compilation message

icc.cpp: In function 'int bs(int, int)':
icc.cpp:38:40: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   38 |         bool f=query(1, mid-l+1, {x}, b);
      |                                        ^
      |                                        |
      |                                        int
In file included from icc.cpp:2:
icc.h:10:30: note:   initializing argument 3 of 'int query(int, int, int*, int*)'
   10 | int query(int a, int b, int *A, int *B);
      |                         ~~~~~^
icc.cpp: In function 'void run(int)':
icc.cpp:56:41: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   56 |             bool f=query(1, numb, {i}, b);
      |                                         ^
      |                                         |
      |                                         int
In file included from icc.cpp:2:
icc.h:10:30: note:   initializing argument 3 of 'int query(int, int, int*, int*)'
   10 | int query(int a, int b, int *A, int *B);
      |                         ~~~~~^