Submission #1052274

#TimeUsernameProblemLanguageResultExecution timeMemory
1052274NickpapadakRack (eJOI19_rack)C++14
40 / 100
2 ms2140 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long const unsigned ll MAXN = 2e+6 + 10; long long N,N2, K; // ll seg[4*MAXN]; stack<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(ll indx){ // if(seg[2*indx]) return findInbalance(2*indx); // if(seg[2*indx+1]) return findInbalance(2*indx+1); // return indx; // } ll AddToQueue(ll i, ll add){ // if(q.size() == K){ // printf("%lld ", q.top()); // return 1; // } // ll s = N2 - add; // 2 ll NN2 = N2; // 3 while(NN2 > add){ if(q.size() == K){ printf("%lld", q.top()); return 1; } q.push(i+NN2); if(AddToQueue(i+NN2, NN2)) return 1; // 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){s return 0; }

Compilation message (stderr)

rack.cpp: In function 'long long int AddToQueue(long long int, long long int)':
rack.cpp:33:21: warning: comparison of integer expressions of different signedness: 'std::stack<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   33 |         if(q.size() == K){
      |            ~~~~~~~~~^~~~
rack.cpp: In function 'int main()':
rack.cpp:47:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |     scanf("%lld%lld", &N, &K);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...