Submission #1200242

#TimeUsernameProblemLanguageResultExecution timeMemory
1200242al95ireyizFinding Routers (IOI20_routers)C++20
100 / 100
2 ms840 KiB
//*** Bismillah ***// #pragma GCC optimize("O3") #pragma GCC optimize("fast-math") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("no-stack-protector") #include <bits/stdc++.h> using namespace std; #if !defined(ONLINE_JUDGE) and !defined(EVAL) #include "template/debug.h" #else #define d(x...) #endif #define fr first #define er erase #define sc second #define in insert #define ll long long #define pb push_back #define vll vector<ll> #define pll pair<ll,ll> #define vvll vector<vll> #define vpll vector<pll> #define len(x)(ll)x.size() #define all(x)x.begin(),x.end() const ll INF = 1e9; const ll INFL = 1e18; const ll MOD = 1e9+7; // const ll MOD = 998244353; const ll maxn = 2e5+5; ll n,m,k=0; #include "routers.h" map<ll, ll> memo; ll f(ll x){ if(memo.count(x)) return memo[x]; return memo[x] = use_detector(x); } vector<int> find_routers(int _l, int _n, int _q){ n = _n, m = _l, k = _q; memo.clear(); // hamisi ucun binary search edeceyik vector<int>v; v.pb(0); for(ll i = 1; i < n; i ++){ ll l = 1, r = m, cv; while(l <= r){ ll md = (l+r)>>1; if(f(md) >= i) r = md - 1, cv = md; else l = md + 1; } v.pb(((cv - 1) - v.back()) * 2 + v.back()); } return v; } // void _(ll tt){ // } // signed main(){ // ll tm=clock(); // cin.tie(0)->sync_with_stdio(0); // ll t=1; // cin>>t; // for(ll tt=1;tt<=t;tt++){ // _(tt); // } // cerr<<"\n\033[1;31mTime: \033[1;30m" \ // <<(double)(clock()-tm)/1000000<<"\033[1;32m seconds\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...