結果
問題 |
No.1133 キムワイプイーター
|
ユーザー |
![]() |
提出日時 | 2020-08-02 16:26:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 689 bytes |
コンパイル時間 | 1,651 ms |
コンパイル使用メモリ | 171,964 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 17:14:44 |
合計ジャッジ時間 | 3,405 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, m; cin >> n >> m; string s; cin >> s; vector< vector<bool> > grids(n + 1, vector<bool>(n + 1, false)); grids[n][0] = true; int cx = 0, cy = n; for (int i = 0; i < m; ++i) { if (s[i] == 'D') cy++; else if (s[i] == 'U') cy--; else if (s[i] == 'R') cx++; else cx--; if (cx < n + 1 && cy < n + 1 && cx >= 0 && cy >= 0) grids[cy][cx] = true; } for (int i = 0; i < n + 1; ++i) { for (int j = 0; j < n + 1; ++j) { if (!grids[i][j]) { cout << 1; } else { cout << 0; } if (j < n) cout << ' '; } puts(""); } return 0; }