結果
| 問題 | No.3544 Robot on Torus (C++) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-16 20:34:28 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 129 ms / 2,000 ms |
| コード長 | 464 bytes |
| 記録 | |
| コンパイル時間 | 1,282 ms |
| コンパイル使用メモリ | 211,712 KB |
| 実行使用メモリ | 99,328 KB |
| スコア | 193 |
| 最終ジャッジ日時 | 2026-05-16 20:34:37 |
| 合計ジャッジ時間 | 8,003 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int h,w,x,y,t=2e6;
vector<string> s(2000);
bool dfs(int x,int y) {
if(s[x][y]=='#')return 1;
if(--t==0) cout << "loop";
else if(dfs((x+1)%h,(y+1)%w))cout << x+1 << " " << y+1;
return 0;
}
int main() {
cin >> h >> w;
for(int i = 0; i < h; i++) {
cin >> s[i];
for(int j = 0; j < w; j++) if(s[i][j] == 'R') x=i,y=j;
}
if(dfs((x+1)%h,(y+1)%w)) cout << x+1 << " " << y+1;
}