# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
794645 |
2023-07-26T18:07:24 Z |
Ludissey |
Rack (eJOI19_rack) |
C++14 |
|
1 ms |
300 KB |
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <vector>
#include <fstream>
#include <bitset>
#include <tuple>
#include <cmath>
#include <cstdint>
#include <stack>
#include <cassert>
#include <cstdio>
#include <queue>
#include <iterator>
#include <iomanip>
#include <algorithm>
#include <sstream>
const int MOD = 1000000007;
using namespace std;
int n, k;
long long power(int x) {
long long sum = 1;
for (int i = 0; i < x; i++){
sum = (sum*2) % MOD;
}
return sum;
}
long long ceiling(int a, int b) {
return (a + b + 1) / 2;
}
long long div(long long l, long long r, long long indx, long long mult) {
if (r == l + 1) return l;
int mid= ceiling(l ,r);
if (indx % mult == 0) {
return div(mid, r, indx, mult * 2);
}
else {
return div(l, mid, indx+(mult/2), mult * 2);
}
}
signed main() {
cin >> n >> k;
long long tot = power(n)%MOD;
int extra = 0;
if (k > tot / 2) {
k -= (tot / 2);
extra = 1;
}
long long ans = div(1, tot, k, 2) + extra;
long long mod = ans % MOD;
cout << mod << "\n";
return 0;
}
//1000000 1000000000000000000
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
300 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
300 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
300 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
300 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |