# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1104028 |
2024-10-22T15:11:25 Z |
vjudge1 |
Rack (eJOI19_rack) |
C++17 |
|
1 ms |
508 KB |
#include <algorithm>
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
const long long mod = 1e9+7;
int binary_exponentiation(long long number, long long exponent)
{
long long result = 1;
while (exponent > 0) {
if(exponent & 1) result = (result * number)%mod;
number = (number * number)%mod;
exponent >>= 1;
}
return result % mod;
}
int make_path(long long seed, int length)
{
long long path = 0;
for (int i = 0; i < min(length, 63); i++) {
if (((seed >> i) & 1) == 1) path = (path + binary_exponentiation(2, length - i - 1))%mod;
}
return path;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long int height, node;
cin >> height >> node;
cout << (make_path(node - 1, height) + 1)%mod << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
508 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |