제출 #119842

#제출 시각아이디문제언어결과실행 시간메모리
119842TuGSGeReL커다란 상품 (IOI17_prize)C++14
20 / 100
90 ms424 KiB
#include "prize.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long #define mp make_pair #define pub push_back #define pob pop_back() #define ss second #define ff first #define mt make_tuple #define pof pop_front() #define fbo find_by_order #define ook order_of_key #define lb lower_bound #define ub upper_bound typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; using pll = pair <ll, ll>; using pii = pair <int, int>; int a[200001], ans = -1; vector <int> resl, resr; void solve(int l, int r) { if ( ans != -1 || l >= r ) return; resl = ask(l); resr = ask(r); if ( resl[0] + resl[1] == 0 ) { ans = l; return; } if ( resr[0] + resr[1] == 0 ) { ans = r; return; } while (resl[0] + resl[1] > resr[0] + resr[1]) { solve(l + 1, r); return; } while (resl[0] + resl[1] < resr[0] + resr[1]) { solve(l, r - 1); return; } if ( resl[0] == resr[0] ) return; int mid = (l + r) / 2; solve(l, mid); solve(mid, r); } int find_best(int n) { int idx = -1, mx = 0, k, sum; for (int i = 0; i < min(n, 500); i++) { vector <int> res = ask(i); if ( res[0] + res[1] > mx ) { mx = res[0] + res[1]; idx = i; k = res[1]; sum = res[1] + res[0]; } } solve(0, n - 1); return ans; }

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

prize.cpp: In function 'int find_best(int)':
prize.cpp:66:6: warning: variable 'idx' set but not used [-Wunused-but-set-variable]
  int idx = -1, mx = 0, k, sum;
      ^~~
prize.cpp:66:24: warning: variable 'k' set but not used [-Wunused-but-set-variable]
  int idx = -1, mx = 0, k, sum;
                        ^
prize.cpp:66:27: warning: variable 'sum' set but not used [-Wunused-but-set-variable]
  int idx = -1, mx = 0, k, sum;
                           ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...