# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
988920 |
2024-05-26T19:45:45 Z |
Zbyszek99 |
Rack (eJOI19_rack) |
C++17 |
|
7 ms |
8288 KB |
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<long long, long long>
#define pb push_back
#define rep(i, b) for(int i = 0; i < (b); ++i)
#define rep2(i,a,b) for(int i = a; i <= (b); ++i)
#define rep3(i,a,b,c) for(int i = a; i <= (b); i+=c)
#define count_bits(x) __builtin_popcountll((x))
#define all(x) (x).begin(),(x).end()
#define size(x) (int)(x).size()
#define forall(it,x) for(auto& it:(x))
using namespace std;
//mt19937 mt;void random(){mt.seed(chrono::time_point_cast<chrono::milliseconds>(chrono::high_resolution_clock::now()).time_since_epoch().count());}
//ll rand(ll a, ll b) {return a + (mt() % (b-a+1));}
const int INF = 1e9+50;
const ll INF_L = 1e18+40;
const ll MOD = 1e9+7;
ll pot[1000001];
void solve()
{
ll n,k;
cin >> n >> k;
k--;
ll wyn = 1;
ll n2 = n;
rep2(i,1,min(62LL,n))
{
if((k % (1LL << i)) >= (1LL << i)/2)
{
wyn += pot[n2-1];
wyn %= MOD;
}
// cout << wyn << " wyn\n";
// k/=2;
n2--;
}
cout << wyn << "\n";
}
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
pot[0] = 1;
rep2(i,1,1000000)
{
pot[i] = pot[i-1]*2;
pot[i] %= MOD;
}
//random();
int t = 1;
// cin >> t;
while(t--) solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
8284 KB |
Output is correct |
2 |
Correct |
6 ms |
8076 KB |
Output is correct |
3 |
Correct |
6 ms |
8288 KB |
Output is correct |
4 |
Correct |
6 ms |
8028 KB |
Output is correct |
5 |
Correct |
6 ms |
8028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
8284 KB |
Output is correct |
2 |
Correct |
6 ms |
8076 KB |
Output is correct |
3 |
Correct |
6 ms |
8288 KB |
Output is correct |
4 |
Correct |
6 ms |
8028 KB |
Output is correct |
5 |
Correct |
6 ms |
8028 KB |
Output is correct |
6 |
Correct |
6 ms |
8284 KB |
Output is correct |
7 |
Correct |
6 ms |
8284 KB |
Output is correct |
8 |
Correct |
7 ms |
8284 KB |
Output is correct |
9 |
Correct |
7 ms |
8284 KB |
Output is correct |
10 |
Correct |
6 ms |
8284 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
8284 KB |
Output is correct |
2 |
Correct |
6 ms |
8076 KB |
Output is correct |
3 |
Correct |
6 ms |
8288 KB |
Output is correct |
4 |
Correct |
6 ms |
8028 KB |
Output is correct |
5 |
Correct |
6 ms |
8028 KB |
Output is correct |
6 |
Correct |
6 ms |
8284 KB |
Output is correct |
7 |
Correct |
6 ms |
8284 KB |
Output is correct |
8 |
Correct |
7 ms |
8284 KB |
Output is correct |
9 |
Correct |
7 ms |
8284 KB |
Output is correct |
10 |
Correct |
6 ms |
8284 KB |
Output is correct |
11 |
Correct |
6 ms |
8280 KB |
Output is correct |
12 |
Correct |
6 ms |
8028 KB |
Output is correct |
13 |
Correct |
6 ms |
8284 KB |
Output is correct |
14 |
Correct |
6 ms |
8028 KB |
Output is correct |
15 |
Correct |
6 ms |
8164 KB |
Output is correct |