Submission #1052175

#TimeUsernameProblemLanguageResultExecution timeMemory
1052175NickpapadakRack (eJOI19_rack)C++14
40 / 100
6 ms8832 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long const unsigned int MAXN = 2e+6 + 10; long long N,N2, K; int seg[4*MAXN]; queue<ll> q; int Update(int low, int high, int i, int indx){ if(low > i || high < i) return seg[indx]; if(low == high && low == i) { seg[indx] = 1; return seg[indx]; } int mid = (low+high)>>1; seg[indx] = Update(low, mid, i, 2*indx) - Update(mid+1, high, i, 2*indx+1); return seg[indx]; } int findInbalance(int indx){ if(seg[2*indx]) return findInbalance(2*indx); if(seg[2*indx+1]) return findInbalance(2*indx+1); return indx; } int AddToQueue(ll i, ll add){ // int s = N2 - add; // 2 ll NN2 = N2; // 3 while(NN2 > add){ // if(q.size() == K){ // printf("%lld", q.front()); // return 1; // } q.push(i+NN2); AddToQueue(i+NN2, NN2); // s = s>>1; NN2 = NN2 >>1; } return 0; } int main(){ scanf("%lld%lld", &N, &K); N2 = 1 << (N-1); q.push(1); // printf("%lld\n", N2); AddToQueue(1, 0); for(int i = 1; i < K; ++i){ q.pop(); }printf("%lld ", q.front()); return 0; }

Compilation message (stderr)

rack.cpp: In function 'int main()':
rack.cpp:44:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |     scanf("%lld%lld", &N, &K);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...