Submission #958819

#TimeUsernameProblemLanguageResultExecution timeMemory
958819M_SH_ORack (eJOI19_rack)C++14
0 / 100
0 ms344 KiB
#pragma GCC optimize("O3") #pragma GCC optimization("Ofast,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include<bits/stdc++.h> #define ll long long #define dou long double #define str string #define pb push_back #define fr first #define se second #define vll vector<ll> #define vpll vector<pair<ll, ll>> #define pll pair<ll, ll> #define endl "\n" using namespace std; ll tree[400004]{}, idx; void update(ll v, ll tl, ll tr) { if(tl == tr) { tree[v] = 1; idx = tl+1; return; } ll tm = (tl+tr)/2; if(tree[v*2] < tree[v*2+1]) { update(v*2, tl, tm); } else { update(v*2+1 , tm + 1, tr); } tree[v] = tree[v*2]+tree[v*2+1]; } int main() { ll n, k, x = 1; cin >> n >> k; for(int i = 0; i < n; i ++) { x *= 2; } n = x; for(int i = 0; i < n*4; i ++) { tree[i] = 0; } for(int i = 0; i < k; i ++) { update(1, 0, n-1); } cout << idx << endl; }

Compilation message (stderr)

rack.cpp:2: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    2 | #pragma GCC optimization("Ofast,unroll-loops")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...