Submission #316079

#TimeUsernameProblemLanguageResultExecution timeMemory
316079MrDominoThe Big Prize (IOI17_prize)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "prize.h" using namespace std; mt19937 rng((long long) (new char)); int rn(int l, int r) { return l + rng() % (r - l + 1); } int rep(int l, int r) { if (l > r) { return 0; } if (l == r) { vector<int> v = ask(l); if (v[0] == 0 && v[1] == 0) { return l; } else { return 0; } } int i = rn(l, r), j = rn(l, r); while (i == j) { j = rn(l, r); } if (i > j) { swap(i, j); } vector<int> v_i = ask(i); vector<int> v_j = ask(j); vector<pair<int, int>> seg; if (v_i == v_j) { if (v_i[0] > 0) seg.push_back({l, i - 1}); if (v_j[1] > 0) seg.push_back({i + 1, r}); } else { if (v_i[0] > 0) seg.push_back({l, i - 1}); if (v_i[0] != v_j[0] || 1) seg.push_back({l + 1, r - 1}); if (v_j[1] > 0) seg.push_back({i + 1, r}); } shuffle(seg.begin(), sge.end(), rng); for (auto &it : seg) { int x = rep(it.first, it.second); if (x) { return x; } } return 0; } int find_best(int n) { return rep(0, n - 1); }

Compilation message (stderr)

prize.cpp: In function 'int rep(int, int)':
prize.cpp:42:24: error: 'sge' was not declared in this scope; did you mean 'seg'?
   42 |   shuffle(seg.begin(), sge.end(), rng);
      |                        ^~~
      |                        seg