結果
| 問題 |
No.367 ナイトの転身
|
| コンテスト | |
| ユーザー |
🍡yurahuna
|
| 提出日時 | 2016-04-04 22:02:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,420 bytes |
| コンパイル時間 | 845 ms |
| コンパイル使用メモリ | 77,876 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-04 00:59:09 |
| 合計ジャッジ時間 | 2,057 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 27 |
ソースコード
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
#include <string>
#include <cassert>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define rep(i,n) for (int i=0;i<(n);i++)
#define Rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
#define PI 3.1415926535
typedef long long ll;
typedef pair<int, int> P;
const int INF = 99999999;
const int MAX_H = 500;
const int MAX_W = 500;
int H, W;
vector<string> field;
bool inside(int x, int y) {
return 0 <= x && x < H && 0 <= y && y < W;
}
int main() {
/* assert code */
cin >> H >> W;
assert(1 <= H && H <= MAX_H);
assert(1 <= W && W <= MAX_W);
field.clear();
field.resize(H);
// 盤面の読み込み & スタート位置、ゴール位置の取得
int sx = -1, sy = -1, gx = -1, gy = -1;
int cntS = 0, cntG = 0;
rep(i, H) {
cin >> field[i];
assert(field[i].size() == W);
rep(j, W) {
if (field[i][j] == 'S') {
sx = i;
sy = j;
cntS++;
} else if (field[i][j] == 'G') {
gx = i;
gy = j;
cntG++;
} else {
assert(field[i][j] == '.' || field[i][j] == 'R');
}
}
}
assert(inside(sx, sy));
assert(inside(gx, gy));
assert(cntS == 1);
assert(cntG == 1);
}
🍡yurahuna