Submission #1099114

#TimeUsernameProblemLanguageResultExecution timeMemory
1099114vjudge1Rack (eJOI19_rack)C++17
40 / 100
1040 ms348 KiB
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int main()
{
    int height, node;
    cin >> height >> node;
    int rows = 1 << height;

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

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

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

Compilation message (stderr)

rack.cpp: In function 'int main()':
rack.cpp:11:9: warning: unused variable 'rows' [-Wunused-variable]
   11 |     int rows = 1 << height;
      |         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...