Submission #958819

# Submission time Handle Problem Language Result Execution time Memory
958819 2024-04-06T19:48:57 Z M_SH_O Rack (eJOI19_rack) C++14
0 / 100
0 ms 344 KB
#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

rack.cpp:2: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    2 | #pragma GCC optimization("Ofast,unroll-loops")
      |
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -