Submission #468802

#TimeUsernameProblemLanguageResultExecution timeMemory
468802errorgornCONSUL (info1cup19_consul)C++17
100 / 100
33 ms200 KiB
//雪花飄飄北風嘯嘯 //天地一片蒼茫 #include "grader.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; #define ll long long #define ii pair<ll,ll> #define iii pair<ii,ll> #define fi first #define se second #define endl '\n' #define debug(x) cout << #x << ": " << x << endl #define pub push_back #define pob pop_back #define puf push_front #define pof pop_front #define lb lower_bound #define ub upper_bound #define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--)) #define all(x) (x).begin(),(x).end() #define sz(x) (int)(x).size() #define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> //change less to less_equal for non distinct pbds, but erase will bug mt19937 rng(chrono::system_clock::now().time_since_epoch().count()); const int MOD=998244353; ll qexp(ll b,ll p,int m){ ll res=1; while (p){ if (p&1) res=(res*b)%m; b=(b*b)%m; p>>=1; } return res; } ll inv(ll i){ return qexp(i,MOD-2,MOD); } ll fix(ll i){ i%=MOD; if (i<0) i+=MOD; return i; } ll fac[1000005]; ll ifac[1000005]; ll nCk(int i,int j){ if (i<j) return 0; return fac[i]*ifac[j]%MOD*ifac[i-j]%MOD; } void solve(int n){ vector<int> v; rep(x,1,n+1) v.pub(x); shuffle(all(v),rng); rep(x,0,min(n,n<=50?25:30)){ int pos=kth(v[x]); if (cnt(pos)>n/3){ say_answer(pos); return; } } say_answer(-1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...