結果
問題 | No.392 2分木をたどれ |
ユーザー |
![]() |
提出日時 | 2016-07-12 00:58:31 |
言語 | C++11 (gcc 8.5.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 654 bytes |
コンパイル時間 | 626 ms |
使用メモリ | 4,904 KB |
最終ジャッジ日時 | 2022-12-08 16:45:12 |
合計ジャッジ時間 | 1,325 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,900 KB |
testcase_01 | AC | 8 ms
4,904 KB |
testcase_02 | AC | 8 ms
4,904 KB |
ソースコード
#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; }