結果

問題 No.2432 Flip and Move
ユーザー umezoumezo
提出日時 2023-08-25 04:30:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,075 bytes
コンパイル時間 2,062 ms
コンパイル使用メモリ 209,168 KB
実行使用メモリ 182,924 KB
最終ジャッジ日時 2023-08-25 04:30:54
合計ジャッジ時間 36,830 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1,189 ms
128,948 KB
testcase_03 TLE -
testcase_04 AC 14 ms
4,776 KB
testcase_05 AC 13 ms
4,504 KB
testcase_06 AC 260 ms
36,080 KB
testcase_07 AC 1,477 ms
119,560 KB
testcase_08 AC 1,681 ms
129,476 KB
testcase_09 TLE -
testcase_10 AC 686 ms
82,696 KB
testcase_11 AC 827 ms
94,188 KB
testcase_12 AC 573 ms
70,996 KB
testcase_13 AC 375 ms
48,952 KB
testcase_14 AC 501 ms
43,224 KB
testcase_15 AC 1,917 ms
151,188 KB
testcase_16 AC 679 ms
53,232 KB
testcase_17 AC 1,524 ms
112,008 KB
testcase_18 AC 334 ms
34,192 KB
testcase_19 AC 1,150 ms
87,184 KB
testcase_20 AC 1,602 ms
123,788 KB
testcase_21 AC 1,132 ms
85,344 KB
testcase_22 AC 1,256 ms
98,620 KB
testcase_23 AC 207 ms
27,172 KB
testcase_24 AC 1,545 ms
108,052 KB
testcase_25 AC 1,030 ms
79,632 KB
testcase_26 AC 504 ms
51,300 KB
testcase_27 AC 25 ms
6,832 KB
testcase_28 AC 18 ms
5,960 KB
testcase_29 AC 1,217 ms
83,224 KB
testcase_30 AC 1,589 ms
116,488 KB
testcase_31 AC 520 ms
48,760 KB
testcase_32 AC 67 ms
11,516 KB
testcase_33 AC 1,499 ms
113,968 KB
testcase_34 AC 797 ms
60,628 KB
testcase_35 AC 250 ms
29,768 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 1 ms
4,380 KB
testcase_38 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int h,w;
  ll k;
  cin>>h>>w>>k;
  vector<vector<char>> G(h,vector<char>(w,'.'));
  
  set<array<int,4>> s;
  int ni=0,nj=0,dh=1,dw=1;
  while(1){
  	s.insert({ni,nj,dh,dw});
  	if(dh==1){
  		if(ni==h-1) dh=0;
  		else ni++;
  	}
  	else{
  		if(ni==0) dh=1;
  		else ni--;
  	}
  	
  	if(dw==1){
  		if(nj==w-1) dw=0;
  		else nj++;
  	}
  	else{
  		if(nj==0) dw=1;
  		else nj--;
  	}
  
    if(s.count({ni,nj,dh,dw})) break;
  }
  int a=s.size();
  k%=a;
  
  ni=0,nj=0,dh=1,dw=1;
  while(k--){
  	if(G[ni][nj]=='.') G[ni][nj]='#';
  	else G[ni][nj]='.';
  	
  	if(dh==1){
  		if(ni==h-1) dh=0;
  		else ni++;
  	}
  	else{
  		if(ni==0) dh=1;
  		else ni--;
  	}
  	
  	if(dw==1){
  		if(nj==w-1) dw=0;
  		else nj++;
  	}
  	else{
  		if(nj==0) dw=1;
  		else nj--;
  	}
  }
  rep(i,h){
  	rep(j,w) cout<<G[i][j];
  	cout<<endl;
  }

  return 0;
}
0