# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
464465 |
2021-08-13T09:07:22 Z |
kilikuma |
Rack (eJOI19_rack) |
C++14 |
|
19 ms |
15532 KB |
#include <bits/stdc++.h>
using namespace std;
long long MOD = (1000*1000*1000)+7;
long long puis(int a, int b) {
long long res =1 ;
for (int i=0;i<b;i++) res = res*a;
return res;
}
long long val(int niveau, long pos) {
if (niveau == 1) {
if (pos == 1) return 1;
else return 2;
}
if (niveau >= 61) {
long long res = val(niveau-1, pos);
res = ((res*2) - 1)%MOD ;
return res;
}
if (pos <= (puis(2, niveau-1))) {
long long res = val(niveau-1, pos);
res = ((res*2)- 1)%MOD;
return res;
}
else {
pos -= puis(2, niveau-1);
long long res = val(niveau-1, pos);
res = (res*2)%MOD;
return res;
}
}
int main() {
long long n, k;
cin >> n >> k;
cout << val(n, k);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
2 ms |
1100 KB |
Output is correct |
15 |
Correct |
19 ms |
15532 KB |
Output is correct |