結果

問題 No.1133 キムワイプイーター
ユーザー a01sa01to
提出日時 2024-05-09 00:24:42
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 666 bytes
コンパイル時間 3,260 ms
コンパイル使用メモリ 252,344 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-15 08:25:10
合計ジャッジ時間 5,272 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
  #define _GLIBCXX_DEBUG
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

int main() {
  int n, m;
  cin >> n >> m;
  n++;
  string s;
  cin >> s;
  vector Grid(n, vector<bool>(n, true));
  Grid[n - 1][0] = false;
  int i = n - 1, j = 0;
  for (char c : s) {
    if (c == 'U') i--;
    if (c == 'D') i++;
    if (c == 'L') j--;
    if (c == 'R') j++;
    Grid[i][j] = false;
  }
  rep(i, n) {
    rep(j, n) cout << (Grid[i][j] ? 1 : 0) << " ";
    cout << endl;
  }
  return 0;
}
0