# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
674298 |
2022-12-23T16:43:28 Z |
Hostek |
Rack (eJOI19_rack) |
C++17 |
|
1 ms |
328 KB |
// https://oj.uz/problem/view/eJOI19_rack
// European Junior Olympiad in Informatics 2019
// Day 1 Tasks
// Hanging Rack
#include <bitset>
#include <iostream>
std::bitset<1000000> tab;
size_t convert_to_bin(long long n) {
if (n == 0) {
return 0;
}
long long i = 0;
while (n > 0) {
tab[i] = n % 2;
n = n / 2;
i++;
}
return i - 1;
}
int main() {
std::ios_base::sync_with_stdio(0);
std::cin.tie(0);
std::cout.tie(0);
long long n, k;
std::cin >> n >> k;
k--;
convert_to_bin(k);
long long rack = 1;
for (int i = 0; i < n; i++) {
long long temp = tab[i] ? (1ll << (n - i - 1)) : tab[i];
rack += temp;
// std::cout << tab[i] << " | val: " << temp << '\n';
}
// std::cout << '\n';
std::cout << rack << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
324 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
324 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
328 KB |
Output is correct |
7 |
Correct |
1 ms |
324 KB |
Output is correct |
8 |
Correct |
0 ms |
212 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 |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
324 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
328 KB |
Output is correct |
7 |
Correct |
1 ms |
324 KB |
Output is correct |
8 |
Correct |
0 ms |
212 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 |
- |