Submission #159606

#TimeUsernameProblemLanguageResultExecution timeMemory
159606maximath_1Cave (IOI13_cave)C++11
Compilation error
0 ms0 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; #define all l, r int s[5069], d[5069]; bool vis[5069]; /*grader start vector<int>S, D; int tryCombination(int ss[], int n){ int minimum=10069; for(int i=0; i<n; i++){ if(ss[i]!=S[i]){ //door is closed minimum=min(minimum, D[i]); } } if(minimum==10069) return -1; return minimum; } void answer(int ss[], int dd[], int n){ bool incorrect=false; for(int i=0; i<n; i++){ if(ss[i]!=S[i]){ incorrect=false; break; } } if(incorrect){ cout<<"WA\n"; exit(0); } for(int i=0; i<n; i++){ if(dd[i]!=D[i]){ incorrect=false; break; } } if(incorrect){ cout<<"WA\n"; exit(0); } cout<<"AC\n"; exit(0); } grader end*/ void flipLever(int l, int r){ for(int i=l; i<=r; i++) if(!vis[i]) s[i]=1-s[i]; //determined levers are stayed untouched } int findLever(int door, int n){ int l=0, r=n-1; if(tryCombination(s, n)!=door) flipLever(all); while(l<r){ int md=(l+r)/2; flipLever(l, md); int tmp=tryCombination(s, n); flipLever(l, md); if(tmp!=door) r=md; else l=md+1; } return l; } void exploreCave(int n){ memset(s, 0, sizeof(s)); memset(vis, false, sizeof(vis)); for(int i=0; i<n; i++){ int lv=findLever(i, n); s[lv]=1-s[lv]; d[lv]=i; vis[lv]=true; } answer(s, d, n); } /*grader start int main(){ int n; S.resize(n); D.resize(n); cin>>n; for(int i=0; i<n; i++) cin>>S[i]; for(int i=0; i<n; i++) cin>>D[i]; exploreCave(n); } grader end*/

Compilation message (stderr)

cave.cpp: In function 'int findLever(int, int)':
cave.cpp:48:24: error: too many arguments to function 'int tryCombination(int*)'
  if(tryCombination(s, n)!=door) flipLever(all);
                        ^
In file included from cave.cpp:1:0:
cave.h:8:5: note: declared here
 int tryCombination(int S[]);
     ^~~~~~~~~~~~~~
cave.cpp:52:30: error: too many arguments to function 'int tryCombination(int*)'
   int tmp=tryCombination(s, n);
                              ^
In file included from cave.cpp:1:0:
cave.h:8:5: note: declared here
 int tryCombination(int S[]);
     ^~~~~~~~~~~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:67:16: error: too many arguments to function 'void answer(int*, int*)'
  answer(s, d, n);
                ^
In file included from cave.cpp:1:0:
cave.h:9:6: note: declared here
 void answer(int S[], int D[]);
      ^~~~~~