結果
| 問題 |
No.331 CodeRunnerでやれ
|
| コンテスト | |
| ユーザー |
fiord
|
| 提出日時 | 2016-01-05 18:36:42 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,359 bytes |
| コンパイル時間 | 1,145 ms |
| コンパイル使用メモリ | 160,908 KB |
| 実行使用メモリ | 96,304 KB |
| 平均クエリ数 | 10.47 |
| 最終ジャッジ日時 | 2024-07-16 08:28:07 |
| 合計ジャッジ時間 | 9,643 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 1 |
| other | RE * 3 TLE * 1 -- * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int use[50][50];
//25,25位からスタート。0:未訪問,1:訪問済み,2:壁
int x=25,y=25;
int direction=0;//0:上,1:右,2:下,3:左
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
bool turn_right(){
int d=(direction+1)%4;
//cout<<"check:"<<x+dx[d]<<","<<y+dy[d]<<":"<<use[y+dy[d]][x+dx[d]]<<endl;
if(use[y+dy[d]][x+dx[d]]==0) return true;
return false;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
while(true){
string s; cin>>s;
if(s=="Merry Christmas!") return 0;
int n=stoi(s);
if(n==0) break;
else cout<<"F"<<endl;
}
bool first=false;
while(true){
use[y][x]=1;
//cout<<"direction:"<<direction<<endl;
//cout<<"condition:"<<use[y+dy[direction]][x+dx[direction]]<<endl;
int n=0;
if(first){
string s; cin>>s;
if(s=="Merry Christmas!") return 0;
n=stoi(s);
}
first=true;
if(n==20151224) cout<<"F"<<endl;//これで終了
else{
//cout<<"cur:"<<x<<","<<y<<endl;
//cout<<"wall:"<<x+dx[direction]*(n+1)<<","<<y+dy[direction]*(n+1)<<endl;
use[y+dy[direction]*(n+1)][x+dx[direction]*(n+1)]=2;
if(turn_right()){
cout<<"R"<<endl;
(direction+=1)%=4;
}
else if(n==0){
cout<<"L"<<endl;
(direction+=3)%=4;
}
else if(use[y+dy[direction]][x+dx[direction]]!=2){
cout<<"F"<<endl;
x+=dx[direction]; y+=dy[direction];
}
}
}
}
fiord