답안 #604532

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
604532 2022-07-25T07:20:59 Z BJoozz CEOI16_icc (CEOI16_icc) C++14
컴파일 오류
0 ms 0 KB
#include "icc.h";
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define X first
#define Y second
#define int long long
mt19937 rng(time(0));
bool randint(int l,int r){
    return uniform_int_distribution < int > (l,r) (rng);
}
void maxx(int &a,int b){if(b>a) a=b;}
void minn(int &a,int b){if(b<a) a=b;}

using ll = long long;
using ii = pair < int , int >;
const int MAX=100+3,inf=1e9,mod=1e9+7;
//int tim=0,sz[MAX];
bool b[MAX];
int pa[MAX];
int A[MAX],B[MAX];
/*vector < int > V[MAX];
int query ( int n,int m,int a[],int b[]){
    return 1;
}
void setRoad(int u,int v){cout<<u<<' '<<v<<'\n';}*/
void run(int N){
    int n=N;
    for(int k=1;k<n;k++){
        int cn=0;
        while(1){
            for(int i=1;i<=n;i++)b[i]=randint(0,1);
            cn=0;
            for(int i=1;i<=n;i++)if(b[pa[i]])
            A[cn++]=i;else B[i-cn-1]=i;
            if(query(cn,n-cn,A,B))break;
        }
        int m=n-cn;
        for(int i=__lg(cn);i>=0;i--)
            if(cn>(1<<i) && query(cn-(1<<i),m,A,B))cn-=(1<<i);
        for(int i=__lg(m);i>=0;i--)
            if(m>(1<<i) && query(cn,m-(1<<i),A,B))m-=(1<<i);
        int u=A[cn-1],v=B[m-1];
        setRoad(u,v);
        u=pa[u];v=pa[v];
        for(int i=1;i<=n;i++) if(pa[i]==v) pa[i]=u;
    }
}

Compilation message

icc.cpp:1:17: warning: extra tokens at end of #include directive
    1 | #include "icc.h";
      |                 ^
icc.cpp: In function 'void run(long long int)':
icc.cpp:36:30: error: cannot convert 'long long int*' to 'int*'
   36 |             if(query(cn,n-cn,A,B))break;
      |                              ^
      |                              |
      |                              long long int*
In file included from icc.cpp:1:
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:40:47: error: cannot convert 'long long int*' to 'int*'
   40 |             if(cn>(1<<i) && query(cn-(1<<i),m,A,B))cn-=(1<<i);
      |                                               ^
      |                                               |
      |                                               long long int*
In file included from icc.cpp:1:
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:42:46: error: cannot convert 'long long int*' to 'int*'
   42 |             if(m>(1<<i) && query(cn,m-(1<<i),A,B))m-=(1<<i);
      |                                              ^
      |                                              |
      |                                              long long int*
In file included from icc.cpp:1:
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);
      |                         ~~~~~^