Submission #966763

# Submission time Handle Problem Language Result Execution time Memory
966763 2024-04-20T10:10:33 Z slumio Rack (eJOI19_rack) C++17
100 / 100
1 ms 460 KB
#include<bits/stdc++.h>
using namespace std;
using ll =long long int;
using ull=unsigned long long;
/*I liked you once but not anymore now*/
int mod=1e9+7;

ll binpow(ll k)
{
 ll res=1LL;
 ll a=2LL;
 while(k>0)
 {
    if(k%2==1)res=(res*a)%mod;
    a=(a*a)%mod;
     
     k/=2LL;
 }
  return res;

}


 void solve(){
       
   ll n,k;cin>>n>>k;
 ll ans=1LL;
 //if(k==1){cout<<1;return;}
   while(k!=1)
   { 
     n--;
     if(k%2==0)
     {
        k=k/2LL;
         ans+=binpow(n);
     }
     else{
        k/=2LL;
        k++;
     }
   
     ans%=mod;
   }
 cout<<ans;

return;
}
int main()
{
std::ios::sync_with_stdio(false);std::cin.tie(nullptr);std::cout.tie(nullptr);

solve();
return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 0 ms 456 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 0 ms 456 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 0 ms 456 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 460 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct