結果

問題 No.2432 Flip and Move
ユーザー 👑 kmjpkmjp
提出日時 2023-08-18 23:31:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,336 bytes
コンパイル時間 2,439 ms
コンパイル使用メモリ 209,400 KB
実行使用メモリ 66,048 KB
最終ジャッジ日時 2024-05-06 06:19:49
合計ジャッジ時間 29,283 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1,003 ms
66,048 KB
testcase_03 TLE -
testcase_04 AC 312 ms
66,048 KB
testcase_05 AC 386 ms
65,920 KB
testcase_06 AC 352 ms
35,968 KB
testcase_07 AC 1,322 ms
43,904 KB
testcase_08 AC 1,207 ms
47,488 KB
testcase_09 AC 1,768 ms
63,616 KB
testcase_10 AC 603 ms
42,880 KB
testcase_11 AC 529 ms
48,896 KB
testcase_12 AC 536 ms
37,248 KB
testcase_13 AC 382 ms
48,640 KB
testcase_14 AC 475 ms
17,536 KB
testcase_15 AC 1,393 ms
54,784 KB
testcase_16 AC 379 ms
28,416 KB
testcase_17 AC 1,377 ms
57,472 KB
testcase_18 AC 215 ms
18,688 KB
testcase_19 AC 1,061 ms
45,184 KB
testcase_20 AC 1,278 ms
63,104 KB
testcase_21 AC 680 ms
44,416 KB
testcase_22 AC 800 ms
50,816 KB
testcase_23 AC 114 ms
15,104 KB
testcase_24 AC 1,199 ms
55,296 KB
testcase_25 AC 874 ms
41,472 KB
testcase_26 AC 538 ms
50,432 KB
testcase_27 AC 25 ms
6,912 KB
testcase_28 AC 11 ms
5,376 KB
testcase_29 AC 747 ms
43,136 KB
testcase_30 AC 540 ms
59,520 KB
testcase_31 AC 275 ms
48,384 KB
testcase_32 AC 58 ms
7,552 KB
testcase_33 AC 719 ms
58,496 KB
testcase_34 AC 267 ms
32,000 KB
testcase_35 AC 184 ms
42,368 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 1 ms
5,376 KB
testcase_38 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------

int H,W;
ll K;


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>H>>W>>K;
	int cy=0,cx=0,dy=1,dx=1;
	int step=0;
	while(step==0||(cy||cx||dy!=1||dx!=1)) {
		step++;
		if(cy+dy<0||cy+dy>=H) dy=-dy;
		else cy+=dy;
		if(cx+dx<0||cx+dx>=W) dx=-dx;
		else cx+=dx;
	}
	K%=2*step;
	map<pair<int,int>,int> M;
	while(K) {
		M[{cy,cx}]^=1;
		if(cy+dy<0||cy+dy>=H) dy=-dy;
		else cy+=dy;
		if(cx+dx<0||cx+dx>=W) dx=-dx;
		else cx+=dx;
		K--;
	}
	FOR(y,H) {
		FOR(x,W) {
			if(M[{y,x}]) cout<<"#";
			else cout<<".";
		}
		cout<<endl;
	}
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0