Submission #549130

#TimeUsernameProblemLanguageResultExecution timeMemory
549130esomerThe Big Prize (IOI17_prize)C++17
0 / 100
73 ms1180 KiB
#include "prize.h" #include<bits/stdc++.h> using namespace std; vector<int> v; vector<int> nw; int a[] = {475, 27, 5, 1}; int mx; void bin(int l, int r, int lx, int rx){ if(v.size() == mx) return; if(l == r){ nw.push_back(l); return; } int mid = (l + r) / 2; vector<int> rep = ask(v[mid]); // int curr = mid; while(rep[0] + rep[1] != mx && curr > l){ nw.push_back(v[curr]); curr--; vector<int> rep = ask(v[curr]); // } if(rep[0] + rep[1] != mx) nw.push_back(v[curr]); if(lx + rep[1] < mx && l < curr) bin(l, curr - 1, lx, rep[1]); curr = mid; while(rep[0] + rep[1] != mx && curr < r){ nw.push_back(v[curr]); curr++; vector<int> rep = ask(v[curr]); // } if(rep[0] + rep[1] != mx) nw.push_back(v[curr]); if(rx + rep[0] < mx && r > curr) bin(mid + 1, r, rep[0], rx); } int find_best(int n) { v.resize(n); for(int i = 0; i < n; i++){ v[i] = i; } int curr = 0; while(v.size() > 1){ mx = 0; for(int i = 0; i < a[curr] && i < v.size(); i++){ vector<int> rep = ask (v[i]); // mx = max(mx, rep[0] + rep[1]); if(rep[0] + rep[1] == 0) return v[i]; } bin(0, v.size() - 1, 0, 0); v = nw; sort(v.begin(), v.end()); nw.clear(); curr++; } return v[0]; }

Compilation message (stderr)

prize.cpp: In function 'void bin(int, int, int, int)':
prize.cpp:12:14: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   12 |  if(v.size() == mx) return;
      |     ~~~~~~~~~^~~~~
prize.cpp: In function 'int find_best(int)':
prize.cpp:45:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |   for(int i = 0; i < a[curr] && i < v.size(); i++){
      |                                 ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...