Submission #675661

# Submission time Handle Problem Language Result Execution time Memory
675661 2022-12-27T16:38:11 Z Truitadepatates Rack (eJOI19_rack) C++14
100 / 100
5 ms 340 KB
#include <bits/stdc++.h>
using namespace std;

int mod = 1000000007;
vector<bool> kbinari;
int n;

void binari(long long int k){
  int i = n-1;
  while (k > 0){
    if (k%2 == 1) kbinari[i] = true;
    else kbinari[i] = false;
    k /= 2;
    i--;
  }
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long int k;
  cin >> n >> k;
  kbinari = vector<bool>(n);
  binari(k-1);
  long long int ans = 1;
  long long int potencia = 1;
  for (int i = 0; i < n; i++){
    if (kbinari[i] == true){
      ans += potencia;
      ans %= mod;
    }
    potencia *= 2;
    potencia %= mod;
  }
  cout << ans << "\n";
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 320 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 320 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 320 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 1 ms 316 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 5 ms 340 KB Output is correct