제출 #845012

#제출 시각아이디문제언어결과실행 시간메모리
845012midi동굴 (IOI13_cave)C++14
컴파일 에러
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) { f0r(i3, 0, n) if (gar[i3]==-1) bar[i3]=0; ll i = tryCombination(bar); /* // printf("try combination("); ll i3; 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]!=bar[i3]; l=m+1; } } if (broke) break; bar[l]^=1; gar[l]=bar[l]; // printf("gar[%lli]: %lli\n", l, (ll)gar[l]); perm[l]=i; // printf("perm[%lli]: %lli\n", l, (ll)perm[l]); // printf("\n"); } f0r(i2,0,n) { gar[i2]=bar[i2]; bar[i2]^=1; ll i; i = tryCombination(bar); /* printf("try combination("); ll i3; f0r(i3,0,n) printf("%lli ", (ll)bar[i3]); printf("): "); scanf("%lli", &i); */ bar[i2]^=1; perm[i2]=i; } // ll i; // f0r(i,0,n) printf("gar[%lli]: %lli, perm[%lli]: %lli\n", i, (ll)gar[i], i, (ll)perm[i]); answer(gar, perm); } /* int main() { ll N; printf("n: "); scanf("%lli", &N); printf("\n"); exploreCave(N); return 0; } */

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:42:7: error: 'i3' was not declared in this scope; did you mean 'i2'?
   42 |   f0r(i3, 0, n) if (gar[i3]==-1) bar[i3]=0;
      |       ^~
cave.cpp:11:25: note: in definition of macro 'f0r'
   11 | #define f0r(i,a,n) for (i=a; i<n; i++)
      |                         ^
cave.cpp:43:10: error: 'tryCombination' was not declared in this scope
   43 |   ll i = tryCombination(bar);
      |          ^~~~~~~~~~~~~~
cave.cpp:65:8: error: 'i3' was not declared in this scope; did you mean 'i'?
   65 |    f1r(i3, l, m) if (gar[i3]==-1) bar[i3]^=1;
      |        ^~
cave.cpp:12:25: note: in definition of macro 'f1r'
   12 | #define f1r(i,a,n) for (i=a; i<=n; i++)
      |                         ^
cave.cpp:93:9: error: 'i3' was not declared in this scope; did you mean 'i'?
   93 |     f1r(i3, l, m) if (gar[i3]==-1) bar[i3]!=bar[i3];
      |         ^~
cave.cpp:12:25: note: in definition of macro 'f1r'
   12 | #define f1r(i,a,n) for (i=a; i<=n; i++)
      |                         ^
cave.cpp:114:7: error: 'tryCombination' was not declared in this scope
  114 |   i = tryCombination(bar);
      |       ^~~~~~~~~~~~~~
cave.cpp:131:2: error: 'answer' was not declared in this scope
  131 |  answer(gar, perm);
      |  ^~~~~~