Submission #568578

#TimeUsernameProblemLanguageResultExecution timeMemory
568578stevancv동굴 (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" #define ll long long #define ld long double #define sp ' ' #define en '\n' #define smin(a, b) a = min(a, b) #define smax(a, b) a = max(a, b) using namespace std; const int N = 2e5 + 2; const int M = 5e5 + 2; int mod = 1000000007; void exploreCave(int n) { int ans[n]; int sw[n]; for (int i = 0; i < n; i++) ans[i] = sw[i] = -1; for (int i = 0; i < n; i++) { vector<int> tmp(n); for (int j = 0; j < n; j++) { if (sw[j] == -1) tmp[j] = 0; else tmp[j] = sw[j]; } int x = (tryCombination(tmp) == i); int l = 0, r = n - 1; while (l < r) { int mid = l + r >> 1; for (int j = 0; j <= mid; j++) { if (sw[j] == -1) tmp[j] = 1; } int y = (tryCombination(tmp) == i); if (x == y) l = mid + 1; else r = mid; for (int j = 0; j <= mid; j++) { if (sw[j] == -1) tmp[j] = 0; } } sw[l] = x; ans[l] = i; } answer(sw, ans); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:23:33: error: cannot convert 'std::vector<int>' to 'int*'
   23 |         int x = (tryCombination(tmp) == i);
      |                                 ^~~
      |                                 |
      |                                 std::vector<int>
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:26:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   26 |             int mid = l + r >> 1;
      |                       ~~^~~
cave.cpp:30:37: error: cannot convert 'std::vector<int>' to 'int*'
   30 |             int y = (tryCombination(tmp) == i);
      |                                     ^~~
      |                                     |
      |                                     std::vector<int>
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~