Submission #256008

# Submission time Handle Problem Language Result Execution time Memory
256008 2020-08-02T07:59:39 Z jdh Rack (eJOI19_rack) C++17
100 / 100
9 ms 7936 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9+7;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n,k;
  cin >> n >> k;
  vector<ll> pow2(n);
  pow2[0] = 1;
  for(int i = 1; i < n; ++i) pow2[i] = (2*pow2[i-1])%mod;
  ll ans = 1;
  int idx = n-1;
  while(true){
    if(k%2 == 0) ans = (ans+pow2[idx])%mod;
    if(k == 1) break;
    k = (k+1)/2;
    --idx;
  }
  cout << ans;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 1 ms 360 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 768 KB Output is correct
15 Correct 9 ms 7936 KB Output is correct