結果
| 問題 | No.2432 Flip and Move |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-17 00:23:50 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 672 ms / 2,000 ms |
| コード長 | 623 bytes |
| 記録 | |
| コンパイル時間 | 1,139 ms |
| コンパイル使用メモリ | 215,964 KB |
| 実行使用メモリ | 73,544 KB |
| 最終ジャッジ日時 | 2026-07-05 17:26:14 |
| 合計ジャッジ時間 | 8,491 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
using ll = long long;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int H,W;
ll K;
cin>>H>>W>>K;
K%=8*H*W;
int y=0,x=0;
int dy=1,dx=1;
vector<vector<bool>> AN(H,vector<bool>(W,0));
for(int k=0;k<K;k++){
AN[y][x]=!AN[y][x];
int ny=dy+y;
int nx=dx+x;
if(ny<0||ny>=H)dy*=-1;
else y=ny;
if(nx<0||nx>=W)dx*=-1;
else x=nx;
}
for(int h=0;h<H;h++){
for(int w=0;w<W;w++)cout<<".#"[AN[h][w]];
cout<<endl;
}
}