結果

問題 No.2432 Flip and Move
ユーザー kotatsugamekotatsugame
提出日時 2023-08-18 21:38:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,274 ms / 2,000 ms
コード長 857 bytes
コンパイル時間 957 ms
コンパイル使用メモリ 82,800 KB
実行使用メモリ 159,488 KB
最終ジャッジ日時 2024-05-06 03:33:58
合計ジャッジ時間 15,800 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 226 ms
143,744 KB
testcase_03 AC 302 ms
159,488 KB
testcase_04 AC 104 ms
77,568 KB
testcase_05 AC 104 ms
77,568 KB
testcase_06 AC 92 ms
58,240 KB
testcase_07 AC 233 ms
104,576 KB
testcase_08 AC 233 ms
113,152 KB
testcase_09 AC 335 ms
153,856 KB
testcase_10 AC 140 ms
92,032 KB
testcase_11 AC 198 ms
105,088 KB
testcase_12 AC 127 ms
78,976 KB
testcase_13 AC 152 ms
79,488 KB
testcase_14 AC 67 ms
38,272 KB
testcase_15 AC 264 ms
131,840 KB
testcase_16 AC 402 ms
32,640 KB
testcase_17 AC 715 ms
67,584 KB
testcase_18 AC 78 ms
21,504 KB
testcase_19 AC 590 ms
52,992 KB
testcase_20 AC 611 ms
74,624 KB
testcase_21 AC 972 ms
51,968 KB
testcase_22 AC 314 ms
59,596 KB
testcase_23 AC 75 ms
17,920 KB
testcase_24 AC 595 ms
65,024 KB
testcase_25 AC 468 ms
48,512 KB
testcase_26 AC 351 ms
59,776 KB
testcase_27 AC 9 ms
7,296 KB
testcase_28 AC 6 ms
5,376 KB
testcase_29 AC 914 ms
50,560 KB
testcase_30 AC 1,176 ms
70,272 KB
testcase_31 AC 483 ms
56,448 KB
testcase_32 AC 15 ms
8,320 KB
testcase_33 AC 1,274 ms
68,480 KB
testcase_34 AC 475 ms
37,120 KB
testcase_35 AC 251 ms
49,664 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cassert>
//#include<atcoder/modint>
using namespace std;
//using mint=atcoder::modint998244353;
int H,W;
long K;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin>>H>>W>>K;
	vector<vector<vector<long> > >vis(H,vector<vector<long> >(W,vector<long>(4,-1)));
	vector<vector<int> >col(H,vector<int>(W,0));
	int x=0,y=0,dir=0;
	while(K>0)
	{
		if(vis[x][y][dir]!=-1)
		{
			long d=vis[x][y][dir]-K;
			d*=2;
			K%=d;
		}
		vis[x][y][dir]=K;
		col[x][y]=1-col[x][y];
		{
			int tx=x;
			if(dir%2==0)tx++;
			else tx--;
			if(tx>=0&&tx<H)x=tx;
			else dir^=1;
		}
		{
			int ty=y;
			if(dir/2==0)ty++;
			else ty--;
			if(ty>=0&&ty<W)y=ty;
			else dir^=2;
		}
		K--;
	}
	for(int i=0;i<H;i++)
	{
		for(int j=0;j<W;j++)cout<<(col[i][j]==0?'.':'#');
		cout<<"\n";
	}
}
0