Submission #763715

#TimeUsernameProblemLanguageResultExecution timeMemory
763715ivopavRack (eJOI19_rack)C++14
40 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; int main(){ long long int n; long long int k; cin >> n >> k; k-=1ll; vector<bool> bin={}; while (k>0ll){ bin.push_back(k%2); k/=2ll; } while (bin.size()<n){ bin.push_back(0ll); } long long int rje=0ll; reverse(bin.begin(),bin.end()); long long int sad=1ll; for (long long int i=0;i<bin.size();i++){ if (bin[i]){ rje+=sad; } sad*=2ll; } cout << rje+1ll << "\n"; }

Compilation message (stderr)

rack.cpp: In function 'int main()':
rack.cpp:14:22: warning: comparison of integer expressions of different signedness: 'std::vector<bool>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   14 |     while (bin.size()<n){
      |            ~~~~~~~~~~^~
rack.cpp:20:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for (long long int i=0;i<bin.size();i++){
      |                            ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...