結果
| 問題 | No.1133 キムワイプイーター |
| ユーザー |
leafirby
|
| 提出日時 | 2020-07-26 15:30:27 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 2,000 ms |
| コード長 | 776 bytes |
| 記録 | |
| コンパイル時間 | 4,017 ms |
| コンパイル使用メモリ | 198,184 KB |
| 最終ジャッジ日時 | 2025-01-12 06:01:01 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 31 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int main(){
int N, M, x, y = 0;
string S;
cin >> N >> M >> S;
assert (0 < N && N <= 200 && 0 < M && M <= 1000000);
x = N;
vector<vector<bool>> seen(N + 1, vector<bool>(N + 1, true));
seen[x][y] = false;
for (auto c : S) {
assert (c == 'D' || c == 'U' || c == 'R' || c == 'L');
int flag = -1;
if (c == 'D') {
flag = 0;
} else if (c == 'U') {
flag = 1;
} else if (c == 'R') {
flag = 2;
} else {
flag = 3;
}
x += dx[flag];
y += dy[flag];
seen[x][y] = false;
}
for (int i = 0; i < N + 1; i++) {
for (int j = 0; j < N + 1; j++) {
cout << seen[i][j] << " ";
}
cout << endl;
}
}
leafirby