Submission #106327

#TimeUsernameProblemLanguageResultExecution timeMemory
106327Kenzo_1114Cave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include"cave.h" #define debug(args...) fprintf(stderr,args) using namespace std; const int MAXN=5010; set<int> s; int N,resp[MAXN],porta[MAXN],v[MAXN]; int tryCombination(int v[]) { for(int i=0;i<N;i++) printf("%d ",v[i]); printf("\n"); int a; scanf("%d",&a); return a; } void color(int i,int j,int v[]) { for(;i<=j;i++) { if(s.find(i)!=s.end()) continue; v[i]^=1; } } void respdireta(int v[]) { for(int i=0;i<N;i++) porta[i]=v[i]; for(int i=0;i<N;i++) { v[i]^=1; int bla=tryCombination(v); resp[i]=bla; v[i]^=1; } } void exploreCave(int N) { for(int i=0;i<N;i++) { int ini=0,fim=N-1; while(ini<fim) { int m=(ini==fim-1) ? ini : (ini+fim)/2; // debug("ini = %d fim = %d m = %d\n",ini,fim,m); debug(""); // debug("Case 1 :\n"); int case1=tryCombination(v);// debug("\n"); if(case1==-1) case1=MAXN; if(case1<=i) { color(ini,m,v); if(tryCombination(v)<=i && tryCombination(v)!=-1) ini=m+1; else{ color(ini,m,v); fim=m; } } else { color(ini,m,v); if(tryCombination(v)<=i && tryCombination(v)!=-1) fim=m; else{ color(m+1,fim,v); ini=m+1; } } } s.insert(ini); porta[ini]=i; v[ini]^=1; // debug("I = %d v[%d] = %d\n",i,ini,v[ini]); } } int main () { scanf("%d",&N); exploreCave(N); for(int i=0;i<N;i++) printf("%d ",v[i]); printf("\n"); for(int i=0;i<N;i++) printf("%d ",porta[i]); printf("\n"); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:3:43: warning: zero-length gnu_printf format string [-Wformat-zero-length]
 #define debug(args...) fprintf(stderr,args)
                                           ^
cave.cpp:50:4: note: in expansion of macro 'debug'
    debug("");
    ^~~~~
cave.cpp: In function 'int tryCombination(int*)':
cave.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&a);
  ~~~~~^~~~~~~~~
cave.cpp: In function 'int main()':
cave.cpp:76:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&N);
  ~~~~~^~~~~~~~~
/tmp/ccudOAwy.o: In function `tryCombination':
cave.cpp:(.text+0x0): multiple definition of `tryCombination'
/tmp/ccoGU1lJ.o:grader.c:(.text+0x90): first defined here
/tmp/ccudOAwy.o: In function `main':
cave.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccoGU1lJ.o:grader.c:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status