Submission #624240

#TimeUsernameProblemLanguageResultExecution timeMemory
624240MatesV13Finding Routers (IOI20_routers)C++17
100 / 100
1 ms724 KiB
#include <bits/stdc++.h> using namespace std; int use_detector(int x); int rezultati[100005]; int nadi(int lo, int hi, int val){ if (lo==hi) return lo; int mid = (lo+hi+1)/2; if (!rezultati[mid]) rezultati[mid] = use_detector(mid) + 1; int odgovor = rezultati[mid]-1; if (odgovor >= val) return nadi(lo, mid-1, val); return nadi (mid, hi, val); } vector<int> find_routers(int l, int n, int q){ vector<int> poz; poz.push_back(0); while (poz.size() != n){ int temp = nadi(0, l, poz.size()); int idx = 2*temp-poz[poz.size()-1]; poz.push_back(idx); } return poz; }

Compilation message (stderr)

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:22:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |  while (poz.size() != n){
      |         ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...