結果
| 問題 |
No.1133 キムワイプイーター
|
| ユーザー |
chacoder1
|
| 提出日時 | 2020-12-01 21:52:30 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 813 bytes |
| コンパイル時間 | 2,314 ms |
| コンパイル使用メモリ | 196,156 KB |
| 最終ジャッジ日時 | 2025-01-16 12:24:10 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 31 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
string s;
cin>>n>>m>>s;
int D[n+1][n+1];
for(int i=0;i<=n;i++){
for(int j=0;j<=n;j++){
D[i][j]=1;
}
}
pair<int,int>P;
P={0,0};
for(int i=0;i<m;i++){
if(s.at(i)=='U'){
P={P.first+1,P.second};
D[P.first][P.second]=0;
}
if(s.at(i)=='D'){
P={P.first-1,P.second};
D[P.first][P.second]=0;
}
if(s.at(i)=='L'){
P={P.first,P.second-1};
D[P.first][P.second]=0;
}
if(s.at(i)=='R'){
P={P.first,P.second+1};
D[P.first][P.second]=0;
}
}
//cout<<P.first<<" "<<P.second<<endl;
D[0][0]=0;
for(int i=n;i>=0;i--){
for(int j=0;j<=n;j++){
if(j !=0) cout<<" ";
cout<<D[i][j];
}
cout<<endl;
}
return 0;
}
chacoder1