답안 #1099114

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1099114 2024-10-10T15:06:20 Z vjudge1 Rack (eJOI19_rack) C++17
40 / 100
1000 ms 348 KB
#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

rack.cpp: In function 'int main()':
rack.cpp:11:9: warning: unused variable 'rows' [-Wunused-variable]
   11 |     int rows = 1 << height;
      |         ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 1 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 1 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Execution timed out 1040 ms 348 KB Time limit exceeded
12 Halted 0 ms 0 KB -