Submission #314392

#TimeUsernameProblemLanguageResultExecution timeMemory
314392uroskRack (eJOI19_rack)C++14
100 / 100
135 ms376 KiB
#include <bits/stdc++.h> #include <chrono> #define ll long long #define ull unsigned long long #define ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define inf 1e15 #define pb push_back #define popb pop_back #define fi first #define sc second using namespace std; using namespace std::chrono; /*auto start = high_resolution_clock::now(); auto stop = high_resolution_clock::now(); auto duration = duration_cast<microseconds>(stop - start); cout << "Time taken by function: " << duration.count() << " microseconds" << endl;*/ ll mod = 1e9+7; int main(){ int n; ll k; cin >> n >> k; ll ans = 0; ll g; for(int i = n;i>=1;i--){ if(k%2==0){ g = 1; for(int j = 0;j<i-1;j++){ g*=2; g%=mod; } ans+=g; ans%=mod; } k=(k+1)/2; } ans++; ans%=mod; cout<<ans; }

Compilation message (stderr)

rack.cpp:5:9: warning: ISO C++11 requires whitespace after the macro name
    5 | #define ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
      |         ^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...