結果

問題 No.392 2分木をたどれ
ユーザー ふーらくたるふーらくたる
提出日時 2016-07-12 00:58:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 654 bytes
コンパイル時間 1,062 ms
コンパイル使用メモリ 69,540 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 15:04:39
合計ジャッジ時間 1,171 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,248 KB
testcase_01 AC 9 ms
5,376 KB
testcase_02 AC 9 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <queue>
#include <utility>
using namespace std;

typedef pair<int, string> P;

int m;
string paths[5000];

int main() {
    cin >> m;

    int id = 0;
    queue<P> que;
    que.push(P(0, paths[0]));
    paths[0] = "";

    while (!que.empty()) {
        P node = que.front(); que.pop();
        if (id + 1 > 4094) continue;
        que.push(P(++id, node.second + "L"));
        paths[id] = node.second + "L";
        que.push(P(++id, node.second + "R"));
        paths[id] = node.second + "R";
    }

    for (int i = 0; i < m; i++) {
        int a;
        cin >> a;
        cout << paths[a] << endl;
    }

    return 0;
}
0