Submission #246858

#TimeUsernameProblemLanguageResultExecution timeMemory
246858hhh07The 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[i][0] + res[i][1] == 0) return i; maxi = max(maxi, res[i][0] + res[i][1]); } int i = 500; while(i < n){ res[i] = ask(i); if (res[i][0] + res[i][1] == 0) return i; if (res[i][0] + res[i][1] == maxi){ int beg = i + 1, end = n - 1; while(beg < end){ int mid = (beg + end)/2; res[mid] = ask(mid); if (res[mid][0] + res[mid][1] == 0) return mid; if (res[mid][0] + res[mid][1] < maxi) end = mid; else{ if (res[i][1] - res[mid][1] > 0) end = mid - 1; else beg = mid + 1; } } res[beg] = ask(beg); if (res[beg][0] + res[beg][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:22:21: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}[int]' for array subscript
         if (res[i][0] + res[i][1] == 0)
                     ^
prize.cpp:22:33: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}[int]' for array subscript
         if (res[i][0] + res[i][1] == 0)
                                 ^
prize.cpp:24:34: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}[int]' for array subscript
         maxi = max(maxi, res[i][0] + res[i][1]);
                                  ^
prize.cpp:24:46: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}[int]' for array subscript
         maxi = max(maxi, res[i][0] + res[i][1]);
                                              ^
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);
                           ^
prize.cpp:32:21: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}[int]' for array subscript
         if (res[i][0] + res[i][1] == 0)
                     ^
prize.cpp:32:33: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}[int]' for array subscript
         if (res[i][0] + res[i][1] == 0)
                                 ^
prize.cpp:34:21: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}[int]' for array subscript
         if (res[i][0] + res[i][1] == maxi){
                     ^
prize.cpp:34:33: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}[int]' for array subscript
         if (res[i][0] + res[i][1] == maxi){
                                 ^
prize.cpp:39:39: error: cannot convert 'std::vector<int>' to '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' in assignment
                     res[mid] = ask(mid);
                                       ^
prize.cpp:40:31: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}[int]' for array subscript
                 if (res[mid][0] + res[mid][1] == 0)
                               ^
prize.cpp:40:45: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}[int]' for array subscript
                 if (res[mid][0] + res[mid][1] == 0)
                                             ^
prize.cpp:42:31: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}[int]' for array subscript
                 if (res[mid][0] + res[mid][1] < maxi)
                               ^
prize.cpp:42:45: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}[int]' for array subscript
                 if (res[mid][0] + res[mid][1] < maxi)
                                             ^
prize.cpp:45:33: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}[int]' for array subscript
                     if (res[i][1] - res[mid][1] > 0)
                                 ^
prize.cpp:45:47: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}[int]' for array subscript
                     if (res[i][1] - res[mid][1] > 0)
                                               ^
prize.cpp:52:35: error: cannot convert 'std::vector<int>' to '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}' in assignment
                 res[beg] = ask(beg);
                                   ^
prize.cpp:53:27: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}[int]' for array subscript
             if (res[beg][0] + res[beg][1] == 0)
                           ^
prize.cpp:53:41: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}[int]' for array subscript
             if (res[beg][0] + res[beg][1] == 0)
                                         ^