제출 #1313781

#제출 시각아이디문제언어결과실행 시간메모리
1313781Chinguun동굴 (IOI13_cave)C++20
컴파일 에러
0 ms0 KiB
#include "cave.h" #define ff first #define ss second #define pb push_back #define ppb pop_back #define meta int tm = (tl + tr) / 2, x = i * 2 + 1, y = x + 1 const int N = 5007; const int TN = 4 * N; const int oo = 1e9; const int mod = 1e9 + 7; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vii; int rev (int x) { if (x) return 0; return 1; } int rec (int l, int r, int p) { if (l == r) return l; int m = (l + r) / 2, re = rev(a[p]); for (int i = m + 1; i <= r; i++) if (!vis[i]) a[i] = re; int c = tryCombination(a); if (c > p || c == -1) return rec (l, m, p); for (int i = m + 1; i <= r; i++) a[i] = k; return rec (m + 1, r, p); } void exploreCave(int N) { n = N; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) a[j] = 1; for (int j = 0; j < n; j++) { if (vis[j]) a[j] = ans1[j]; } int b = tryCombination(a); if (b > i || b == -1) k = 1; else { k = 0; for (int j = 0; j < n; j++) if (!vis[j]) a[i] = k; } int pos = rec(0, n - 1, i); ans2[pos] = i; ans1[pos] = k; a[pos] = k; vis[pos] = 1; } answer (ans1, ans2); return; }

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

cave.cpp:14:9: error: 'pair' does not name a type
   14 | typedef pair<int, int> pii;
      |         ^~~~
cave.cpp:15:9: error: 'vector' does not name a type
   15 | typedef vector<int> vi;
      |         ^~~~~~
cave.cpp:16:16: error: 'pii' was not declared in this scope
   16 | typedef vector<pii> vii;
      |                ^~~
cave.cpp:16:16: error: 'pii' was not declared in this scope
cave.cpp:16:16: error: 'pii' was not declared in this scope
cave.cpp:16:16: error: 'pii' was not declared in this scope
cave.cpp:16:16: error: 'pii' was not declared in this scope
cave.cpp:16:16: error: 'pii' was not declared in this scope
cave.cpp:16:9: error: 'vector' does not name a type
   16 | typedef vector<pii> vii;
      |         ^~~~~~
cave.cpp: In function 'int rec(int, int, int)':
cave.cpp:26:35: error: 'a' was not declared in this scope
   26 |     int m = (l + r) / 2, re = rev(a[p]);
      |                                   ^
cave.cpp:29:14: error: 'vis' was not declared in this scope
   29 |         if (!vis[i]) a[i] = re;
      |              ^~~
cave.cpp:34:45: error: 'k' was not declared in this scope
   34 |     for (int i = m + 1; i <= r; i++) a[i] = k;
      |                                             ^
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:39:5: error: 'n' was not declared in this scope
   39 |     n = N;
      |     ^
cave.cpp:41:37: error: 'a' was not declared in this scope
   41 |         for (int j = 0; j < n; j++) a[j] = 1;
      |                                     ^
cave.cpp:43:17: error: 'vis' was not declared in this scope
   43 |             if (vis[j]) a[j] = ans1[j];
      |                 ^~~
cave.cpp:43:25: error: 'a' was not declared in this scope
   43 |             if (vis[j]) a[j] = ans1[j];
      |                         ^
cave.cpp:43:32: error: 'ans1' was not declared in this scope
   43 |             if (vis[j]) a[j] = ans1[j];
      |                                ^~~~
cave.cpp:45:32: error: 'a' was not declared in this scope
   45 |         int b = tryCombination(a);
      |                                ^
cave.cpp:46:31: error: 'k' was not declared in this scope
   46 |         if (b > i || b == -1) k = 1;
      |                               ^
cave.cpp:48:13: error: 'k' was not declared in this scope
   48 |             k = 0;
      |             ^
cave.cpp:50:22: error: 'vis' was not declared in this scope
   50 |                 if (!vis[j]) a[i] = k;
      |                      ^~~
cave.cpp:54:9: error: 'ans2' was not declared in this scope
   54 |         ans2[pos] = i;
      |         ^~~~
cave.cpp:55:9: error: 'ans1' was not declared in this scope
   55 |         ans1[pos] = k;
      |         ^~~~
cave.cpp:55:21: error: 'k' was not declared in this scope
   55 |         ans1[pos] = k;
      |                     ^
cave.cpp:57:9: error: 'vis' was not declared in this scope
   57 |         vis[pos] = 1;
      |         ^~~
cave.cpp:59:13: error: 'ans1' was not declared in this scope
   59 |     answer (ans1, ans2);
      |             ^~~~
cave.cpp:59:19: error: 'ans2' was not declared in this scope
   59 |     answer (ans1, ans2);
      |                   ^~~~