제출 #828685

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
8286852023-08-17 13:34:14gromperen커다란 상품 (IOI17_prize)C++14
0 / 100
22 ms11996 KiB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5+5;
vector<int> p;
vector<vector<int>> memo(MAXN, vector<int>(2, -1));
vector<int> _ask(int i) {
if (memo[i][0] != -1) return memo[i];
return memo[i] = ask(p[i]);
}
int find_best(int n) {
int mx = 0;
int sqrtn = sqrt(n);
p.resize(n);
for (int i = 0; i < n; ++i) {
p[i] = i;
}
srand(420);
random_shuffle(p.begin(), p.end());
int k = 0;
for(int i = 0; i < sqrtn; i++) {
vector<int> res = _ask(i);
if(res[0] + res[1] == 0) return p[i];
mx = max(mx, res[0] + res[1]);
}
for (int i = sqrtn; i < n; ++i) {
auto res = _ask(i);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

prize.cpp: In function 'int find_best(int)':
prize.cpp:23:6: warning: unused variable 'k' [-Wunused-variable]
   23 |  int k = 0;
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...