Submission #840855

#TimeUsernameProblemLanguageResultExecution timeMemory
840855raul2008487Rack (eJOI19_rack)C++17
40 / 100
3 ms3500 KiB
#include <bits/stdc++.h> #define pb push_back #define fi first #define se second #define ll long long #define vl vector<ll> #define endl "\n" #define all(v) v.begin(), v.end() using namespace std; const int sz = 2e5+5; const ll inf = 100000000000000005; const int mod = 1e9+7; ll tp[sz]; ll rec(ll k, ll n){ if(n==0){ return k; } ll lc = k/2 + k%2; ll rc = k/2; if(lc == rc){ return (tp[n-1] + rec(rc, n-1))%mod; } return rec(lc,n-1); } void solve(){ ll n,k,i,j; cin>>n>>k; tp[0] = 1; for(i=1;i<=n;i++){ tp[i] = tp[i-1] * 2; tp[i] %= mod; } cout << rec(k, n) << endl; } int main(){ ll t=1; //cin>>t; while(t--){ solve(); } }

Compilation message (stderr)

rack.cpp: In function 'void solve()':
rack.cpp:26:14: warning: unused variable 'j' [-Wunused-variable]
   26 |     ll n,k,i,j;
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...