Submission #989070

#TimeUsernameProblemLanguageResultExecution timeMemory
989070AdamGSFinding Routers (IOI20_routers)C++17
100 / 100
1 ms452 KiB
#include "routers.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() vector<int>T; void solve(int l, int r, int a, int b) { T[a]=min(T[a], l); if(a==b) return; if(l+1>=r) { T[a]=min(T[a], l); return; } int mid=(l+r)/2; int x=use_detector(mid); solve(l, mid, a, x); solve(mid, r, x, b); } vector<int>find_routers(int l, int n, int q) { rep(i, n) T.pb(l); solve(0, l, 0, n-1); vector<int>ans; ans.pb(0); rep(i, n-1) { int x=T[i+1]-ans.back()-1; ans.pb(ans.back()+2*x); } 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...