Submission #841574

# Submission time Handle Problem Language Result Execution time Memory
841574 2023-09-01T17:25:36 Z WLZ Rack (eJOI19_rack) C++17
100 / 100
8 ms 8028 KB
#include <bits/stdc++.h>
using namespace std;

const long long MOD = (long long) 1e9 + 7;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  long long k;
  cin >> n >> k;
  k--;
  vector<long long> pw(n);
  pw[0] = 1;
  for (int i = 1; i < n; i++) {
    pw[i] = (pw[i - 1] * 2) % MOD;
  }
  long long ans = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (k % 2 == 1) {
      ans = (ans + pw[i]) % MOD;
    }
    k /= 2;
  }
  cout << ans + 1 << '\n';
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 456 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 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 348 KB Output is correct
3 Correct 0 ms 456 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 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 348 KB Output is correct
3 Correct 0 ms 456 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 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 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 860 KB Output is correct
15 Correct 8 ms 8028 KB Output is correct