Submission #963980

#TimeUsernameProblemLanguageResultExecution timeMemory
963980vivkostovCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define "cave.h" using namespace std; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int n,a[5005],b[5005]; /*int tryCombination(int comb[]) { for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(b[j]==i) { if(a[j]!=comb[j])return i; } } } return -1; } */ int code[5005],perm[5005]; /*void answer(int code[]) { for(int i=0;i<n;i++) { cout<<code[i]<<" "; } cout<<endl; } */ void exploreCave(int n) //void read() { //cin>>n; for(int i=0;i<n;i++) { //cin>>a[i]; } for(int i=0;i<n;i++) { // in>>b[i]; } /* code[0]=1; code[1]=0; code[2]=1; code[3]=0; */ int h; for(int i=0;i<n;i++) { int g=tryCombination(code); if(g==-1) { answer(code); } if(g>i) { h=0; for(int i=0;i<n;i++) { if(!perm[i]) { code[i]=1; } } } else h=1; int l=0,r=n-1,mi; while(l<=r) { mi=(l+r)/2; for(int j=l;j<=mi;j++) { if(!perm[j])code[j]=h; } g=tryCombination(code); for(int j=l;j<=mi;j++) { if(!perm[j])code[j]=(h+1)%2; } if(g>i||g==-1)r=mi-1; else l=mi+1; } //cout<<l<<endl; perm[l]=1; code[l]=h; for(int i=0;i<n;i++) { //cout<<perm[i]<<" "; } //cout<<endl; for(int i=0;i<n;i++) { if(!perm[i])code[i]=0; //cout<<code[i]<<" "; } //cout<<endl; } answer(code); } int main() { speed(); read(); return 0; }

Compilation message (stderr)

cave.cpp:2:9: error: macro names must be identifiers
    2 | #define "cave.h"
      |         ^~~~~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:57:15: error: 'tryCombination' was not declared in this scope
   57 |         int g=tryCombination(code);
      |               ^~~~~~~~~~~~~~
cave.cpp:60:13: error: 'answer' was not declared in this scope
   60 |             answer(code);
      |             ^~~~~~
cave.cpp:105:5: error: 'answer' was not declared in this scope
  105 |     answer(code);
      |     ^~~~~~
cave.cpp: In function 'int main()':
cave.cpp:110:5: error: 'read' was not declared in this scope; did you mean 'fread'?
  110 |     read();
      |     ^~~~
      |     fread