제출 #300647

#제출 시각아이디문제언어결과실행 시간메모리
300647rocks03Finding Routers (IOI20_routers)C++14
98.10 / 100
2 ms512 KiB
#include<bits/stdc++.h> #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define ff first #define ss second #define pb push_back #define SZ(x) ((int) (x).size()) using namespace std; int use_detector(int x); vector<int> find_routers(int l, int n, int q){ vector<int> ans(n); vector<int> maxpos(n, l); ans[0] = 0; int last = 0; for(int i = 1; i < n; i++){ int l = last + 1, r = maxpos[i]; while(r - l > 1){ int m = (l + r) / 2; int index = use_detector(m); maxpos[index] = min(m, maxpos[index]); if(index != i-1) r = m; else l = m; } ans[i] = 2 * ((r - 1) - last) + last; last = ans[i]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...