Submission #1082620

#TimeUsernameProblemLanguageResultExecution timeMemory
1082620KALARRYCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
//chockolateman #include<bits/stdc++.h> #include "cave.h" using namespace std; int pos[5005]; bool check(vector<int> combo,int door) { int res = tryCombination(combo); return (res > door || res == -1); } void exploreCave(int N) { vector<int> cur; for(int i = 0 ; i < N ; i++) { pos[i] = -1; cur.push_back(0); } for(int i = 0 ; i < N ; i++) { int res = tryCombination(cur); if(res > i || res==-1) for(int j = 0 ; j < N ; j++) if(pos[j]==-1) cur[j] = (cur[j] + 1)%2; int cur_switch = -1; for(int b = N ; b >= 1 ; b/=2) { if(cur_switch + b > N) continue; vector<int> temp = cur; for(int j = 0 ; j <= cur_switch + b; j++) if(pos[j]==-1) temp[j] = (temp[j] + 1)%2; while(cur_switch + b < N && !check(temp,i)) { cur_switch += b; for(int j = 0 ; j <= cur_switch ; j++) if(pos[j]==-1) cur[j] = (cur[j] + 1)%2; for(int j = 0 ; j <= cur_switch + b; j++) if(pos[j]==-1) temp[j] = (temp[j] + 1)%2; } } cur_switch++; pos[cur_switch] = i; cur[cur_switch] = (cur[cur_switch] + 1)%2; } vector<int> D; for(int i = 0 ; i < N ; i++) D.push_back(pos[i]); answer(cur,D); }

Compilation message (stderr)

cave.cpp: In function 'bool check(std::vector<int>, int)':
cave.cpp:12:30: error: cannot convert 'std::vector<int>' to 'int*'
   12 |     int res = tryCombination(combo);
      |                              ^~~~~
      |                              |
      |                              std::vector<int>
In file included from cave.cpp:4:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:26:34: error: cannot convert 'std::vector<int>' to 'int*'
   26 |         int res = tryCombination(cur);
      |                                  ^~~
      |                                  |
      |                                  std::vector<int>
In file included from cave.cpp:4:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:58:12: error: cannot convert 'std::vector<int>' to 'int*'
   58 |     answer(cur,D);
      |            ^~~
      |            |
      |            std::vector<int>
In file included from cave.cpp:4:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~