제출 #335262

#제출 시각아이디문제언어결과실행 시간메모리
335262bigDuckCave (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
#include "cave.h"
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll








int n;

int s[5010];
int  d[5010];
bool v[5010];


/*void answer(int S[],int D[]){
cout<<"S: ";
for(int i=0; i<n; i++){
    cout<<s[i]<<" ";
}cout<<"\n";

cout<<"D: ";
for(int i=0; i<n; i++){
    cout<<d[i]<<" ";
}cout<<"\n"<<flush;


}*/



/*int tryCombination(int S[]){

for(int i=0; i<n; i++){
    cout<<s[i]<<" ";
}cout<<"\n"<<flush;
int res;
cin>>res;
return res;
}*/


void door_state(int ind, bool &st){

int crd=tryCombination(s);
crd--;
if( (crd>=ind) || (crd==-2) ){
    st=true;
}
else{
    st=false;
}

return;
}



void query(int ind, bool &st){


int l=0, r=(n-1), m=(l+r)>>1;
//st-state: 0-closed, 1-open;


while(l<r){
        m=(l+r)>>1;
    for(int i=l; i<=m; i++){
        if(!v[i]){
            s[i]=s[i]^1;
        }
    }
    bool st0=st;
    door_state(ind, st);

    if(st0!=st){
        r=m; m=(l+r)>>1; continue;
    }


    l=(m+1); m=(l+r)>>1;

}

if(st==false){
    s[m]^=1;
}
d[m]=ind;
v[m]=true;

}








void exploreCave(int N){
n=N;

for(int i=0; i<n; i++){
    bool st=false;
    door_state(i, st);
    query(i, st);
}

answer(s, d);

}

















/*int32_t main(){
INIT
int N; cin>>N;
exploreCave(N);





return 0;
}*/



컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'void door_state(long long int, bool&)':
cave.cpp:57:24: error: cannot convert 'long long int*' to 'int*'
   57 | int crd=tryCombination(s);
      |                        ^
      |                        |
      |                        long long int*
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp: In function 'void exploreCave(long long int)':
cave.cpp:121:8: error: cannot convert 'long long int*' to 'int*'
  121 | answer(s, d);
      |        ^
      |        |
      |        long long int*
In file included from cave.cpp:2:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~