Submission #569587

#TimeUsernameProblemLanguageResultExecution timeMemory
569587Aurora2005Cave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include"cave.h"; using namespace std; void exploreCave(int N){ vector<pair<int,int>> ans(N); for(int i=0;i<N;i++) ans[i] = make_pair(-1,-1); for(int i=0;i<N;i++){ vector<int> First(N); for(int j=0;j<N;j++){ if(ans[j].first == -1) First[j] = 0; else First[j] = ans[j].second; } if(tryCombination(First) == i+1){ int l = 0,r = N; while(r-l > 1){ int m = (l+r)/2; vector<int> S(N); for(int j=0;j<N;j++){ if(ans[j].first){ if(j < m) S[j] = 0; else S[j] = 1; } else S[j] = ans[j].second; } if(tryCombination(S) == i+1) r = m; else l = m; } ans[l].first = i+1; ans[l].second = 1; } else{ int l = 0,r = N; while(r-l > 1){ int m = (l+r)/2; vector<int> S(N); for(int j=0;j<N;j++){ if(ans[j].first){ if(j < m) S[j] = 0; else S[j] = 1; } else S[j] = ans[j].second; } if(tryCombination(S) == i+1) l = m; else r = m; } ans[l].first = i+1; ans[l].second = 0; } } vector<int> ansS(N),ansD(N); for(int i=0;i<N;i++){ ansS[i] = ans[i].second; ansD[i] = ans[i].first; } answer(ansS,ansD); }

Compilation message (stderr)

cave.cpp:2:17: warning: extra tokens at end of #include directive
    2 | #include"cave.h";
      |                 ^
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:14:23: error: cannot convert 'std::vector<int>' to 'int*'
   14 |     if(tryCombination(First) == i+1){
      |                       ^~~~~
      |                       |
      |                       std::vector<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:26:27: error: cannot convert 'std::vector<int>' to 'int*'
   26 |         if(tryCombination(S) == i+1) r = m;
      |                           ^
      |                           |
      |                           std::vector<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:44:27: error: cannot convert 'std::vector<int>' to 'int*'
   44 |         if(tryCombination(S) == i+1) l = m;
      |                           ^
      |                           |
      |                           std::vector<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:56:10: error: cannot convert 'std::vector<int>' to 'int*'
   56 |   answer(ansS,ansD);
      |          ^~~~
      |          |
      |          std::vector<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[]);
      |             ~~~~^~~