제출 #1162225

#제출 시각아이디문제언어결과실행 시간메모리
1162225mateuszwesFinding Routers (IOI20_routers)C++20
0 / 100
2096 ms324 KiB
#include "routers.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned ll #define pb push_back #define pii pair<int,int> #define pl pair<ll,ll> #define F first #define S second #define pq priority_queue #define all(x) x.begin(), x.end() #define deb(x) cout << #x << " = " << x << '\n'; #define deb2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << '\n'; int bs(int last, int poc, int kon){ //szuka najwiekszego gdzie use detector zwraca last while(kon > poc){ int mid = (poc+kon)/2; //deb(mid); int ok = use_detector(mid); if(ok == last) poc = mid; else if(ok < last) poc = mid+1; else kon = mid-1; //deb2(poc, kon); } return poc; } vector<int> find_routers(int l, int n, int q) { vector<int> ans(n); for(int i = 1; i < n; i++){ int coc = bs(i-1, (ans[i-1]+1),l)-ans[i-1]; ans[i] = ans[i-1]+2*coc; } 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...