Submission #246859

#TimeUsernameProblemLanguageResultExecution timeMemory
246859hhh07The Big Prize (IOI17_prize)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include <algorithm> #include <queue> #include <utility> #include <set> #include <cmath> #include <cstring> #include "prize.h" using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<ll, ll> ii; int find_best(int n){ vector<int> res; int maxi = 0; for (int i = 0; i < min(500, n); i++){ res[i] = ask(i); if (res[0] + res[1] == 0) return i; maxi = max(maxi, res[0] + res[1]); } int i = 500; while(i < n){ res[i] = ask(i); if (res[0] + res[1] == 0) return i; if (res[0] + res[1] == maxi){ int beg = i + 1, end = n - 1; while(beg < end){ int mid = (beg + end)/2; vi t; t = ask(mid); if (t[0] + t[1] == 0) return mid; if (t[0] + t[1] < maxi) end = mid; else{ if (res[1] - t[1] > 0) end = mid - 1; else beg = mid + 1; } } res = ask(beg); if (res[0] + res[1] == 0) return beg; i = beg + 1; } else i++; } return i; }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:21:23: error: cannot convert 'std::vector<int>' to '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' in assignment
         res[i] = ask(i);
                       ^
prize.cpp:31:27: error: cannot convert 'std::vector<int>' to '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' in assignment
             res[i] = ask(i);
                           ^