結果

問題 No.1133 キムワイプイーター
ユーザー SSRS
提出日時 2020-11-10 07:02:09
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 858 ms
コンパイル使用メモリ 72,188 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-22 17:11:06
合計ジャッジ時間 2,270 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
	int n, m;
	cin >> n >> m;
	string s;
	cin >> s;
	vector<vector<int>> a(n + 1, vector<int>(n + 1, 1));
	a[0][0] = 0;
	int y = 0, x = 0;
	for (int i = 0; i < m; i++){
		if (s[i] == 'U'){
			y++;
		}
		if (s[i] == 'R'){
			x++;
		}
		if (s[i] == 'L'){
			x--;
		}
		if (s[i] == 'D'){
			y--;
		}
		a[y][x] = 0;
	}
	for (int i = n; i >= 0; i--){
		for (int j = 0; j <= n; j++){
			cout << a[i][j];
			if (j < n){
				cout << ' ';
			}
		}
		cout << endl;
	}
}
0