Submission #29923

#TimeUsernameProblemLanguageResultExecution timeMemory
29923aybalaCave (IOI13_cave)C++11
Compilation error
0 ms0 KiB
#include "cave.h" #include<bits/stdc++.h> #define fori(a,b,c) for(int a=b; a<c; a++) #define ford(a,b,c) for(int a=b; a>=c; a--) #define ll long long #define pb push_back #define mp make_pair #define pii pair<int,int> #define fi first #define se second using namespace std; int n; int sw[5000];#include "cave.h" #include<bits/stdc++.h> #define fori(a,b,c) for(int a=b; a<c; a++) #define ford(a,b,c) for(int a=b; a>=c; a--) #define ll long long #define pb push_back #define mp make_pair #define pii pair<int,int> #define fi first #define se second using namespace std; int n; int sw[5000]; int used[5000]; pii a[8900],b[8900]; int s[5000],d[5000]; void exploreCave(int N) { /*n=N; int lg=0; while((1<<lg) < n){ lg++; } cout << lg; int nn=(1<<lg); fori(i,0,n){ int las=0; int x=0; fori(j,0,lg+1){ fori(k,las,las+(nn/(1<<(j)))+x){ if(k>=n) break; if(!used[k]){ sw[k]=(b[i].se+1)%2; } else{ sw[k]=a[k].se; } } int trc=tryCombination(sw); if(n==1){ if(trc!=i){ b[i].se=1; } a[i].fi=i; a[i].se=b[i].se; } if(j==lg){ if(trc!=i){ used[las+1]=1; b[i].fi=las+1; a[las+1].fi=i; a[las+1].se=b[i].se; } else{ used[las]=1; b[i].fi=las; a[las].fi=i; a[las].se=b[i].se; } break; } if(trc!=i && j==0){ b[i].se = 1; continue; } if(trc==i && j==0){ fori(k,las,las+(nn/(1<<(j)))+x){ if(k>=n) break; if(!used[k]){ sw[k]=0; } else{ sw[k]=a[k].se; } } continue; } if(trc!=i && j!=0){ las=las+(nn/(1<<(j)))+x; continue; } if(trc==i && j!=0){ fori(k,las,las+(nn/(1<<(j)))+x){ if(k>=n) break; if(!used[k]){ sw[k]=(b[i].se)%2; } else{ sw[k]=a[k].se; } } continue; } } } fori(i,0,n){ s[i]=a[i].se; d[i]=a[i].fi; }*/ fori(i,0,80000){ tryCombination(sw); } answer(s,d); return ; } int used[5000]; pii a[8900],b[8900]; int s[5000],d[5000]; void exploreCave(int N) { n=N; int lg=0; while((1<<lg) < n){ lg++; } cout << lg; int nn=(1<<lg); fori(i,0,n){ int las=0; int x=0; fori(j,0,lg+1){ fori(k,las,las+(nn/(1<<(j)))+x){ if(k>=n) break; if(!used[k]){ sw[k]=(b[i].se+1)%2; } else{ sw[k]=a[k].se; } } int trc=tryCombination(sw); if(n==1){ if(trc!=i){ b[i].se=1; } a[i].fi=i; a[i].se=b[i].se; } if(j==lg){ if(trc!=i){ used[las+1]=1; b[i].fi=las+1; a[las+1].fi=i; a[las+1].se=b[i].se; } else{ used[las]=1; b[i].fi=las; a[las].fi=i; a[las].se=b[i].se; } break; } if(trc!=i && j==0){ b[i].se = 1; continue; } if(trc==i && j==0){ fori(k,las,las+(nn/(1<<(j)))+x){ if(k>=n) break; if(!used[k]){ sw[k]=0; } else{ sw[k]=a[k].se; } } continue; } if(trc!=i && j!=0){ las=las+(nn/(1<<(j)))+x; continue; } if(trc==i && j!=0){ fori(k,las,las+(nn/(1<<(j)))+x){ if(k>=n) break; if(!used[k]){ sw[k]=(b[i].se)%2; } else{ sw[k]=a[k].se; } } continue; } } } fori(i,0,n){ s[i]=a[i].se; d[i]=a[i].fi; } answer(s,d); return ; }

Compilation message (stderr)

cave.cpp:17:14: error: stray '#' in program
 int sw[5000];#include "cave.h"
              ^
cave.cpp:17:15: error: 'include' does not name a type
 int sw[5000];#include "cave.h"
               ^~~~~~~
cave.cpp:30:5: error: redefinition of 'int n'
 int n;
     ^
cave.cpp:15:5: note: 'int n' previously declared here
 int n;
     ^
cave.cpp:32:12: error: redefinition of 'int sw [5000]'
 int sw[5000];
            ^
cave.cpp:17:5: note: 'int sw [5000]' previously declared here
 int sw[5000];#include "cave.h"
     ^~
cave.cpp:149:14: error: redefinition of 'int used [5000]'
 int used[5000];
              ^
cave.cpp:34:5: note: 'int used [5000]' previously declared here
 int used[5000];
     ^~~~
cave.cpp:151:11: error: redefinition of 'std::pair<int, int> a [8900]'
 pii a[8900],b[8900];
           ^
cave.cpp:36:5: note: 'std::pair<int, int> a [8900]' previously defined here
 pii a[8900],b[8900];
     ^
cave.cpp:151:19: error: redefinition of 'std::pair<int, int> b [8900]'
 pii a[8900],b[8900];
                   ^
cave.cpp:36:13: note: 'std::pair<int, int> b [8900]' previously defined here
 pii a[8900],b[8900];
             ^
cave.cpp:153:11: error: redefinition of 'int s [5000]'
 int s[5000],d[5000];
           ^
cave.cpp:38:5: note: 'int s [5000]' previously declared here
 int s[5000],d[5000];
     ^
cave.cpp:153:19: error: redefinition of 'int d [5000]'
 int s[5000],d[5000];
                   ^
cave.cpp:38:13: note: 'int d [5000]' previously declared here
 int s[5000],d[5000];
             ^
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:155:6: error: redefinition of 'void exploreCave(int)'
 void exploreCave(int N) {
      ^~~~~~~~~~~
cave.cpp:40:6: note: 'void exploreCave(int)' previously defined here
 void exploreCave(int N) {
      ^~~~~~~~~~~