結果
問題 | No.2432 Flip and Move |
ユーザー |
|
提出日時 | 2024-09-17 00:25:20 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 128 ms / 2,000 ms |
コード長 | 720 bytes |
コンパイル時間 | 1,926 ms |
コンパイル使用メモリ | 208,752 KB |
実行使用メモリ | 73,496 KB |
最終ジャッジ日時 | 2024-09-17 00:25:26 |
合計ジャッジ時間 | 5,264 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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;#include<atcoder/modint>using namespace atcoder;using mint=modint998244353;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<<"\n";}}