이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
rack.cpp:2: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
2 | #pragma GCC optimization("Ofast,unroll-loops")
|
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |