제출 #122659

#제출 시각아이디문제언어결과실행 시간메모리
122659SirCeness커다란 상품 (IOI17_prize)C++14
0 / 100
5 ms2108 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++){ vector<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; vector<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++){ vector<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; vector<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++){ vector<int> ans = ask(arr[i]); if (ans[0] == 0 && ans[1] == 0){ return arr[i]; } } assert(0); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...