Submission #230247

#TimeUsernameProblemLanguageResultExecution timeMemory
230247mat_vGap (APIO16_gap)C++14
0 / 100
79 ms3308 KiB
#include "gap.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i)) #define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i)) #define mod 998244353 #define xx first #define yy second #define all(a) (a).begin(), (a).end() #define pb push_back #define ll long long #define pii pair<int,int> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;/// find_by_order(x)(x+1th) , order_of_key() (strictly less) mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); long long findGap(int t, int n){ if(t == 1){ ll l = 0; ll r = 1000000000; r *= r; vector<ll>svi; while(l <= r){ ll mn,mx; MinMax(l,r,&mn,&mx); svi.pb(mx); if(mn == -1 || mx == -1)break; if(mn != mx)svi.pb(mn); l = mn+1; r = mx-1; } sort(svi.begin(), svi.end()); ll res = 0; ff(i,1,n - 1){ res = max(res, svi[i] - svi[i - 1]); } return res; } else if(t == 2){ ll mn,mx; ll l = 0; ll r = 1000000000; r *= r; vector<ll> svi; MinMax(l,r,&mn,&mx); svi.pb(mn); svi.pb(mx); ll dif = mx - mn; dif /= (n-1); for(ll i = mn; i<=mx; i+=dif){ ll p1,p2; MinMax(i,i+dif,&p1,&p2); if(p1 == -1)continue; svi.pb(p1); svi.pb(p2); } ll res = 0; ff(i,1,n - 1){ res = max(res, svi[i] - svi[i - 1]); } return res; } }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:71:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...