Submission #122658

#TimeUsernameProblemLanguageResultExecution timeMemory
122658SirCenessThe Big Prize (IOI17_prize)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #include "prize.h" using namespace std; typedef long long ll; int arr[200005]; int n; int tmp[200005]; // 22 int find_best(int size){ n = size; for (int i = 0; i < size; i++) arr[i] = i; int maxx = 0; for (int i = 0; i < min(10, n); i++){ int* ans = ask(i); maxx = max(ans[0] + ans[1], maxx); } int tmpsize = 0; for (int i = 0; i < maxx; i++){ int l = 0; int r = n-1; while (l < r){ int m = (l+r+1)/2; int *ans = ask(arr[m]); if (ans[0] > i) r = m-1; else l = m; } tmp[tmpsize++] = arr[l+1]; } for (int i = 0; i < tmpsize; i++){ arr[i] = tmp[i]; } n = tmpsize; maxx = 0; for (int i = 0; i < min(10, n); i++){ int* ans = ask(i); maxx = max(ans[0] + ans[1], maxx); } tmpsize = 0; for (int i = 0; i < maxx; i++){ int l = 0; int r = n-1; while (l < r){ int m = (l+r+1)/2; int *ans = ask(arr[m]); if (ans[0] > i) r = m-1; else l = m; } tmp[tmpsize++] = arr[l+1]; } for (int i = 0; i < n; i++){ int *ans = ask(arr[i]); if (ans[0] == 0 && ans[1] == 0){ return arr[i]; } } assert(0); }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:20:19: error: cannot convert 'std::vector<int>' to 'int*' in initialization
   int* ans = ask(i);
                   ^
prize.cpp:30:25: error: cannot convert 'std::vector<int>' to 'int*' in initialization
    int *ans = ask(arr[m]);
                         ^
prize.cpp:45:19: error: cannot convert 'std::vector<int>' to 'int*' in initialization
   int* ans = ask(i);
                   ^
prize.cpp:55:25: error: cannot convert 'std::vector<int>' to 'int*' in initialization
    int *ans = ask(arr[m]);
                         ^
prize.cpp:63:24: error: cannot convert 'std::vector<int>' to 'int*' in initialization
   int *ans = ask(arr[i]);
                        ^