結果

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

ソースコード

diff #

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  int n,m;
  string s;
  cin>>n>>m>>s;
  
  int G[n+1][n+1];
  rep(i,n+1){
    rep(j,n+1) G[i][j]=1;
  }
  G[n][0]=0;
  
  int y=n,x=0;
  rep(i,m){
    if(s[i]=='U') y--;
    else if(s[i]=='D') y++;
    else if(s[i]=='R') x++;
    else x--;
    G[y][x]=0;
  }
  
  rep(i,n+1){
    rep(j,n+1){
      if(j) cout<<" ";
      cout<<G[i][j];
    }
    cout<<endl;
  }
  
  return 0;
}
0