結果

問題 No.1133 キムワイプイーター
ユーザー AkabaEri
提出日時 2021-01-23 09:28:38
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 782 bytes
コンパイル時間 1,713 ms
コンパイル使用メモリ 167,640 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 02:27:28
合計ジャッジ時間 3,918 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll mod= 1e9 + 7;
ll mmod= 998244353;



int main(){
  int n,m;
  string s;
  cin >> n >>m >>s;
  n++;
  int a[n][n];
  rep(i,n)rep(r,n)a[i][r]=1;
  a[0][0]=0;
  pair<int,int>p=make_pair(0,0);

  rep(i,m){
    if(s[i]=='R')p.first++;
    if(s[i]=='L')p.first--;
    if(s[i]=='U')p.second++;
    if(s[i]=='D')p.second--;
    a[p.first][p.second]=0;
  }

  for(int i=n-1;i>=0;i--){
    rep(r,n){
      cout << a[r][i];
      if(r==n-1){cout << endl;}else{cout << " ";}
    }
  }

}
0