Submission #492473

#TimeUsernameProblemLanguageResultExecution timeMemory
4924731neCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; void exploreCave(int n) { /* ... */ int cur = 0; int swit[n] = {-1}; int ans[n] = {0}; while(cur<n){ int left = 0,right = n-1; int val = -1; while(left<=right){ for (int j = 0;j<2;++j){ vector<int>temp(n,0); int mid = (left + right)>>1; for (int i = 0;i<mid;++i){ if (swit[i]==-1){ temp[i] = j; } else temp[i] = ans[i]; } for (int i = mid;i<n;++i){ if (swit[i]==-1){ temp[i] = j; } else{ temp[i] = ans[i]; } } int a = tryCombination(temp); if (a>cur){ val = j; break; } } assert(val!=-1); vector<int>temp(n,0); int mid = (left + right)>>1; for (int i = 0;i<mid;++i){ if (swit[i]==-1){ temp[i] = val; } else temp[i] = ans[i]; } for (int i = mid;i<n;++i){ if (swit[i]==-1){ temp[i] = val^1; } else temp[i] = ans[i]; } int a = tryCombination(temp); if (a>cur){ right = mid-1; } else{ left = mid; } } swit[left] = cur; ans[left] = val; ++cur; } answer(ans,swit); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:30:27: error: cannot convert 'std::vector<int>' to 'int*'
   30 |    int a = tryCombination(temp);
      |                           ^~~~
      |                           |
      |                           std::vector<int>
In file included from cave.cpp:1:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:51:32: error: cannot convert 'std::vector<int>' to 'int*'
   51 |         int a = tryCombination(temp);
      |                                ^~~~
      |                                |
      |                                std::vector<int>
In file included from cave.cpp:1:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~