# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
624611 |
2022-08-08T14:37:52 Z |
Blagoj |
Rack (eJOI19_rack) |
C++14 |
|
4 ms |
2512 KB |
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
int main()
{
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
ull n, k;
cin >> n >> k;
vector<ull> v = {1, (ull)(1 << (n - 1)) + 1};
ull sum = (1 << (n - 2));
if (k == 1)
{
cout << 1;
return 0;
}
if (k == 2)
{
cout << v[1];
return 0;
}
while (sum > 0)
{
ull sz = v.size();
for (ull i = 0; i < sz; i++)
{
if ((i + 1) + sz == k)
{
cout << (ull)v[i] + sum;
return 0;
}
if (sum > 1)
{
v.push_back(v[i] + sum);
}
}
sum /= 2;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 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 |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
600 KB |
Output is correct |
9 |
Correct |
2 ms |
1492 KB |
Output is correct |
10 |
Correct |
4 ms |
2512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
600 KB |
Output is correct |
9 |
Correct |
2 ms |
1492 KB |
Output is correct |
10 |
Correct |
4 ms |
2512 KB |
Output is correct |
11 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |