結果
問題 | No.392 2分木をたどれ |
ユーザー |
![]() |
提出日時 | 2018-01-17 01:03:08 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 788 ms / 2,000 ms |
コード長 | 843 bytes |
コンパイル時間 | 827 ms |
コンパイル使用メモリ | 90,160 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 05:58:48 |
合計ジャッジ時間 | 2,930 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 |
ソースコード
#include <iostream> #include <iomanip> #include <vector> #include <algorithm> #include <string> #include <sstream> #include <cmath> #include <stack> #include <queue> #include <cctype> #include <stdio.h> #include <map> #include <string.h> #include <utility> typedef long long ll; using namespace std; int main() { int m=0; cin>>m; queue<pair<int,string> > qu; pair<int,string> p(0,""); for(int i=0; i<m; i++){ int target =0; cin>>target; string ans =""; qu.push(p); int k=1; while(!qu.empty()){ pair<int,string> p = qu.front(); qu.pop(); if(p.first >target){ continue; } if(p.first==target){ ans =p.second; } string s = p.second; pair<int,string> np(p.first+k,s+"L"); qu.push(np); k++; pair<int,string> nnp(p.first+k,s+"R"); qu.push(nnp); } cout<<ans<<endl; } return 0; }