結果
問題 | No.392 2分木をたどれ |
ユーザー |
|
提出日時 | 2020-07-02 03:10:04 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 463 bytes |
コンパイル時間 | 1,756 ms |
コンパイル使用メモリ | 195,588 KB |
最終ジャッジ日時 | 2025-01-11 13:55:59 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define REP(i,n) for(int i=0; i<(int)(n); i++)string ans[4096];void dfs(int x, int p) {if (x >= 4096)return;if (p != -1)ans[x] = x % 2 ? ans[p] + "L" : ans[p] + "R";dfs(2*x+1, x);dfs(2*x+2, x);}int main() {ios_base::sync_with_stdio(0);cin.tie(0);dfs(0, -1);int n;cin >> n;REP (i, n) {int x;cin >> x;cout << ans[x] << endl;}return 0;}