Submission #845945

#TimeUsernameProblemLanguageResultExecution timeMemory
845945midiCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define vc vector typedef vc<ll> vcll; #define pr pair typedef pr<ll, ll> prll; #define f0r(i,a,n) for (i=a; i<n; i++) #define f1r(i,a,n) for (i=a; i<=n; i++) #define r0f(i,n,a) for (i=n; i>a; i--) #define r1f(i,n,a) for (i=n; i>=a; i--) #define pb push_back #define mp make_pair #define INF (LLONG_MAX>>4ll) #define mxN 5010ll ll n; int bar[mxN]; int gar[mxN]; int perm[mxN]; void exploreCave(int N) { n=N; ll i2; f0r(i2,0,n) { bar[i2]=0; perm[i2]=-1; gar[i2]=-1; } f0r(i2,0,n) { ll i3; f0r(i3, 0, n) if (gar[i3]==-1) bar[i3]=0; ll i; i = tryCombination(bar); /* printf("try combination("); f0r(i3,0,n) printf("%lli ", (ll)bar[i3]); printf("): "); scanf("%lli", &i); */ if (i==-1) break; ll j; ll l=0, r=n-1; // both incl. bool broke=0; while (l<r) { ll m; m = ((l+1>=r) ? l : (l+r)/2); // printf("l: %lli, m: %lli, r: %lli\n", l, m, r); f1r(i3, l, m) if (gar[i3]==-1) bar[i3]^=1; j = tryCombination(bar); /* printf("try combination("); f0r(i3,0,n) printf("%lli ", (ll)bar[i3]); printf("): "); scanf("%lli", &j); */ if (j==-1) { broke=1; break; } if (j<i) { i=j; r=m; } else if (j==i) { l=m+1; } else { f1r(i3, l, m) if (gar[i3]==-1) bar[i3]^=1; r=m; } } if (broke) break; j = tryCombination(bar); /* printf("try combination("); f0r(i3,0,n) printf("%lli ", (ll)bar[i3]); printf("): "); scanf("%lli", &j); */ if (i==j) bar[l]^=1; gar[l]=bar[l]; // printf("gar[%lli]: %lli\n", l, (ll)gar[l]); perm[l]=i; // printf("gar[%lli]: %lli, perm[%lli]: %lli\n", l, (ll)gar[l], l, (ll)perm[l]); // printf("perm[%lli]: %lli\n", l, (ll)perm[l]); // printf("\n"); } f0r(i2,0,n) { gar[i2]=bar[i2]; if (perm==-1) { ll i; bar[i2]^=1; i = tryCombination(bar); bar[i2]^=1; perm[i2]=i; } /* printf("try combination("); ll i3; f0r(i3,0,n) printf("%lli ", (ll)bar[i3]); printf("): "); scanf("%lli", &i); */ } /* ll i; printf("gar: "); f0r(i,0,n) printf("%lli ", (ll)gar[i]); printf("perm: "); f0r(i,0,n) printf("%lli ", (ll)perm[i]); */ answer(gar, perm); } /* int main() { ll N; printf("n: "); scanf("%lli", &N); printf("\n"); exploreCave(N); return 0; } */

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:125:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  125 |   if (perm==-1)
      |       ~~~~^~~~