結果
問題 |
No.2432 Flip and Move
|
ユーザー |
|
提出日時 | 2024-09-17 00:23:50 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,331 ms / 2,000 ms |
コード長 | 623 bytes |
コンパイル時間 | 2,163 ms |
コンパイル使用メモリ | 199,260 KB |
最終ジャッジ日時 | 2025-02-24 08:58:55 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; } }