結果

問題 No.1133 キムワイプイーター
ユーザー kotatsugame
提出日時 2020-07-27 01:12:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 389 bytes
コンパイル時間 543 ms
コンパイル使用メモリ 64,768 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 19:47:20
合計ジャッジ時間 2,094 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int N,M;
int A[201][201];
string S;
main()
{
	cin>>N>>M>>S;
	for(int i=0;i<=N;i++)for(int j=0;j<=N;j++)A[i][j]=1;
	A[0][0]=0;
	int x=0,y=0;
	for(int i=0;i<M;i++)
	{
		if(S[i]=='U')y++;
		else if(S[i]=='D')y--;
		else if(S[i]=='R')x++;
		else x--;
		A[y][x]=0;
	}
	for(int y=N;y>=0;y--)for(int x=0;x<=N;x++)
	{
		cout<<A[y][x]<<(x==N?"\n":" ");
	}
}
0