結果
| 問題 | 
                            No.1133 キムワイプイーター
                             | 
                    
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-12-22 00:16:05 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 12 ms / 2,000 ms | 
| コード長 | 738 bytes | 
| コンパイル時間 | 1,592 ms | 
| コンパイル使用メモリ | 171,796 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-21 13:28:42 | 
| 合計ジャッジ時間 | 2,631 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 31 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using Int   = int_fast64_t;
using Word  = uint_fast64_t;
using VInt  = vector<Int>;
using VWord = vector<Word>;
using VB  = vector<bool>;
using VVB = vector<VB>;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  Int n, m;
  cin >> n >> m;
  VVB vis(n + 1, VB(n + 1));
  vis[0][0] = true;
  
  Int x = 0;
  Int y = 0;
  string s;
  cin >> s;
  for (char c : s) {
    if (c == 'U') y++;
    else if (c == 'D') y--;
    else if (c == 'R') x++;
    else x--;
    vis[y][x] = true;
  }
  for (Int i = 0; i <= n; i++) {
    for (Int j = 0; j <= n; j++) {
      if (j) cout << " ";
      if (vis[n - i][j]) cout << 0;
      else cout << 1;
    }
    cout << '\n';
  }
  return 0;
}