Submission #397211

#TimeUsernameProblemLanguageResultExecution timeMemory
397211idk321The Big Prize (IOI17_prize)C++11
Compilation error
0 ms0 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; int n; int to; pair<int, vector<int>> differentRight(int a, vector<int> inf, bool small) { int b = to; if (small) { b = min(b, a + 500); } int res = -1; vector<int> rinf; a++; while (a <= b) { int mid = (a + b) / 2; vector<int> cinf = ask(mid); if (cinf[0] == 0 && cinf[1] == 0) return {mid, {0, 0}}; if (cinf[0] == 0) { vector<int> next = ask(mid + 1); return {mid + 1, next}; } if (cinf[1] == 0) { to = mid - 1; } if (cinf == inf) { a = mid + 1; } else { res = mid; rinf = cinf; b = mid - 1; } } return {res, rinf}; } int find_best(int N) { n = N; to = n - 1; /* if (n <= 5000) { int res = -1; for (int i = 0; i < n; i++) { vector<int> v = ask(i); if (v[0] == 0 && v[1] == 0) res = i; } return res; } */ vector<int> big = {0, 0}; vector<int> inf; int cur = 0; inf = ask(cur); big = max(big, inf); for (int i = 0; i < 4; i++) { auto p1 = differentRight(cur, inf); cur = p1.first; inf = p1.second; big = max(big, inf); } int ca = 0; inf = ask(0); vector<int> needed = {0, 0}; while(inf != needed) { if (inf[0] + inf[1] == big[0] + big[1]) { auto p1 = differentRight(ca, inf, false); ca = p1.first; inf = p1.second; } else { auto p1 = differentRight(ca, inf, true); ca = p1.first; inf = p1.second; } } return ca; }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:76:42: error: too few arguments to function 'std::pair<int, std::vector<int> > differentRight(int, std::vector<int>, bool)'
   76 |         auto p1 = differentRight(cur, inf);
      |                                          ^
prize.cpp:10:24: note: declared here
   10 | pair<int, vector<int>> differentRight(int a, vector<int> inf, bool small)
      |                        ^~~~~~~~~~~~~~