| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 958819 | M_SH_O | Rack (eJOI19_rack) | C++14 | 0 ms | 344 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
