結果

問題 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,061 ms
コンパイル使用メモリ 207,012 KB
実行使用メモリ 66,136 KB
最終ジャッジ日時 2023-08-18 23:32:35
合計ジャッジ時間 27,236 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1,002 ms
65,976 KB
testcase_03 TLE -
testcase_04 AC 301 ms
65,824 KB
testcase_05 AC 382 ms
66,136 KB
testcase_06 AC 351 ms
36,152 KB
testcase_07 AC 1,247 ms
43,984 KB
testcase_08 AC 1,203 ms
47,288 KB
testcase_09 AC 1,751 ms
63,616 KB
testcase_10 AC 588 ms
42,852 KB
testcase_11 AC 509 ms
48,612 KB
testcase_12 AC 528 ms
37,084 KB
testcase_13 AC 366 ms
48,664 KB
testcase_14 AC 460 ms
17,348 KB
testcase_15 AC 1,315 ms
54,800 KB
testcase_16 AC 337 ms
28,224 KB
testcase_17 AC 1,206 ms
57,332 KB
testcase_18 AC 178 ms
18,484 KB
testcase_19 AC 954 ms
44,992 KB
testcase_20 AC 1,188 ms
63,096 KB
testcase_21 AC 578 ms
44,216 KB
testcase_22 AC 752 ms
50,768 KB
testcase_23 AC 104 ms
15,152 KB
testcase_24 AC 1,050 ms
55,280 KB
testcase_25 AC 725 ms
41,252 KB
testcase_26 AC 543 ms
50,384 KB
testcase_27 AC 22 ms
6,684 KB
testcase_28 AC 11 ms
4,792 KB
testcase_29 AC 640 ms
43,176 KB
testcase_30 AC 556 ms
59,564 KB
testcase_31 AC 260 ms
48,268 KB
testcase_32 AC 57 ms
7,408 KB
testcase_33 AC 677 ms
58,268 KB
testcase_34 AC 247 ms
31,944 KB
testcase_35 AC 177 ms
42,252 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 1 ms
4,380 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