제출 #1202060

#제출 시각아이디문제언어결과실행 시간메모리
1202060AMel0nFinding Routers (IOI20_routers)C++20
100 / 100
1 ms328 KiB
// BROO NO HATE PLS
// IM ON MOBILE
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,N) for(ll i = 0; i < N; i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()

#include "routers.h"

vector<int> find_routers(int l, int n, int q) {
  vector<int> res(n);
  vector<int> his(n, l);
  for(int i = 1; i < n; i++) {
    int le = res[i-1], ri = his[i];
    while(le < ri - 1) {
      int mi = (le + ri) / 2;
      int im = use_detector(mi);
      if (i <= im) {
        ri = mi;
        for (int j = im; j > i; j--) his[j] = min(his[j], mi);
      }
      else le = mi;
    }
    res[i] = le * 2 - res[i - 1];
  }
  return res;
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...