Submission #778655

#TimeUsernameProblemLanguageResultExecution timeMemory
778655benjaminkleynThe Big Prize (IOI17_prize)C++17
Compilation error
0 ms0 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; bool asked[200000] = {false}; int L[200000], R[200000]; unorderd_map<int, set<int>> queries; bool Ask(int i) { if (asked[i]) return L[i] + R[i] == 0; asked[i] = true; vector<int> res = ask(i); L[i] = res[0], R[i] = res[1]; if (queries.find(L[i] + R[i]) == queries.end()) queries[L[i] + R[i]] = set<int>(); queries[L[i] + R[i]].insert(i); return L[i] + R[i] == 0; } int Find(int l, int r) { if (Ask(l)) return l; if (Ask(r)) return r; if (l + 1 == r) return -1; for (auto [x, s] : queries) { auto it1 = s.upper_bound(l), it2 = s.lower_bound(r); if (it1 == s.begin() || it2 == s.end()) continue; if (L[*prev(it1)] == L[*it2]) return -1; } int m = (l + r) / 2; int x = Find(l, m); if (x >= 0) return x; int y = Find(m, r); if (y >= 0) return y; return -1; } int find_best(int n) { return Find(0, n - 1); }

Compilation message (stderr)

prize.cpp:8:1: error: 'unorderd_map' does not name a type
    8 | unorderd_map<int, set<int>> queries;
      | ^~~~~~~~~~~~
prize.cpp: In function 'bool Ask(int)':
prize.cpp:18:9: error: 'queries' was not declared in this scope
   18 |     if (queries.find(L[i] + R[i]) == queries.end())
      |         ^~~~~~~
prize.cpp:20:5: error: 'queries' was not declared in this scope
   20 |     queries[L[i] + R[i]].insert(i);
      |     ^~~~~~~
prize.cpp: In function 'int Find(int, int)':
prize.cpp:33:24: error: 'queries' was not declared in this scope
   33 |     for (auto [x, s] : queries)
      |                        ^~~~~~~
prize.cpp:36:33: error: 'it2' was not declared in this scope
   36 |         if (it1 == s.begin() || it2 == s.end()) continue;
      |                                 ^~~
prize.cpp:37:33: error: 'it2' was not declared in this scope
   37 |         if (L[*prev(it1)] == L[*it2]) return -1;
      |                                 ^~~