Submission #650785

#TimeUsernameProblemLanguageResultExecution timeMemory
650785LitusianoCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; //#define int long long map<int,int> used; void convert(int * v[],int idx, int val){ for(int i = 0; i< idx; i++){ if(used[i]) continue; v[i] = val; } } void exploreCave(int N) { /* ... */ int v[N]; for(int i = 0; i<N; i++){ v[i] = 0; } int s[N]; // Busco combinacio correcte for(int i = 0; i<N; i++){ bool ok = 0; int l = 0; int r = N; int val = 0; convert(v,N,0); if(tryCombination(v) == i) val = 1; while(r > l+1){ int m = (l+r)/2; convert(v,m,val); // si s'ha obert, int x = tryCombination(v); if (x == -1){ ok = 1; break; } if(x == i){ //obert l = m; } else r = m; convert(v,m,val^1); } if(ok) break; used[l] = 1; v[l] = val; } for(int i = 0; i<N; i++){ v[i] ^= 1; s[i] = tryCombination(v); v[i] ^= 1; } answer(v,s); //for(int i = 0; i<N; i++) cout<<v[i]<<" "; cout<<endl; //for(int i = 0; i<N; i++) cout<<s[i]<<" "; cout<<endl; return; }

Compilation message (stderr)

cave.cpp: In function 'void convert(int**, int, int)':
cave.cpp:11:12: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   11 |     v[i] = val;
      |            ^~~
      |            |
      |            int
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:27:13: error: cannot convert 'int*' to 'int**'
   27 |     convert(v,N,0);
      |             ^
      |             |
      |             int*
cave.cpp:8:20: note:   initializing argument 1 of 'void convert(int**, int, int)'
    8 | void convert(int * v[],int idx, int val){
      |              ~~~~~~^~~
cave.cpp:31:15: error: cannot convert 'int*' to 'int**'
   31 |       convert(v,m,val);
      |               ^
      |               |
      |               int*
cave.cpp:8:20: note:   initializing argument 1 of 'void convert(int**, int, int)'
    8 | void convert(int * v[],int idx, int val){
      |              ~~~~~~^~~
cave.cpp:42:15: error: cannot convert 'int*' to 'int**'
   42 |       convert(v,m,val^1);
      |               ^
      |               |
      |               int*
cave.cpp:8:20: note:   initializing argument 1 of 'void convert(int**, int, int)'
    8 | void convert(int * v[],int idx, int val){
      |              ~~~~~~^~~