Submission #288451

#TimeUsernameProblemLanguageResultExecution timeMemory
288451topovikRack (eJOI19_rack)C++14
40 / 100
1 ms256 KiB
#include <bits/stdc++.h> #define f first #define s second #define pb push_back #define INF 1000000000 using namespace std; typedef long long ll; typedef long double ld; const ll oo = 1e12; const ll N = 1e6; int main() { ll n,k; cin>>n>>k; vector <ll> steps; for (ll i=0; i<n; i++) { if (!(k&1)) { k>>=1; steps.pb(1); } else {steps.pb(0);k=(k+1)/2;} } ll ans=0; for (ll i=0; i<steps.size(); i++) ans=(ans*2+steps[i]); cout<<1+ans; }

Compilation message (stderr)

rack.cpp: In function 'int main()':
rack.cpp:31:19: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for (ll i=0; i<steps.size(); i++) ans=(ans*2+steps[i]);
      |                  ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...