Submission #1099130

# Submission time Handle Problem Language Result Execution time Memory
1099130 2024-10-10T15:31:53 Z vjudge1 Rack (eJOI19_rack) C++17
40 / 100
0 ms 348 KB
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int height, node;
    cin >> height >> node;
    int rows = 1 << height;

    std::vector<int> path(height);
    for (int j = 0; j < height; ++j) {
        path[j] = ((node - 1) >> j) & 1;
    }
    

    long long int leaf = 1;
    long long int set = pow(2, height);
    for (int i : path)
    {
        set = set/2;
        if (i == 1) leaf += set;
    }

    cout << leaf << endl;
    return 0;
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:14:9: warning: unused variable 'rows' [-Wunused-variable]
   14 |     int rows = 1 << height;
      |         ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Incorrect 0 ms 348 KB Output isn't correct
12 Halted 0 ms 0 KB -