Submission #1265909

#TimeUsernameProblemLanguageResultExecution timeMemory
1265909rutra454Rack (eJOI19_rack)C++20
100 / 100
98 ms436 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long ll pot(ll dl){ ll wyn = 1; for(int i = 1; i < dl; ++i){ wyn *= 2; wyn %= 1000000007; } return wyn; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n,k; cin >> n >> k; ll pocz = 1, dl = n; for(int i = 0; i < n; ++i){ //cout << pocz << ' ' << dl << ';' << k << '\n'; if(k % 2 == 0){ pocz += pot(dl); pocz %= 1000000007; dl--; } else{ dl--; } k = k/2 + k%2; } cout << pocz % 1000000007; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...