結果

問題 No.1133 キムワイプイーター
ユーザー kyo1
提出日時 2020-08-04 23:14:53
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 2,131 ms
コンパイル使用メモリ 198,780 KB
最終ジャッジ日時 2025-01-12 14:26:42
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  string S;
  cin >> S;
  vector G(N + 1, vector(N + 1, false));
  G[0][0] = true;
  int x = 0, y = 0;
  for (auto s : S) {
    if (s == 'U') y++;
    if (s == 'R') x++;
    if (s == 'L') x--;
    if (s == 'D') y--;
    G[y][x] = true;
  }
  for (int i = N; i > -1; i--) {
    for (int j = 0; j < N + 1; j++) {
      cout << (!G[i][j] ? 1 : 0) << (j == N ? '\n' : ' ');
    }
  }
  return 0;
}
0