結果
問題 |
No.2432 Flip and Move
|
ユーザー |
![]() |
提出日時 | 2023-08-24 14:07:09 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,124 ms / 2,000 ms |
コード長 | 539 bytes |
コンパイル時間 | 1,757 ms |
コンパイル使用メモリ | 198,212 KB |
最終ジャッジ日時 | 2025-02-16 13:01:16 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 36 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ ll H, W, K, x=1, y=1, h=1, w=1; cin >> H >> W >> K; K %= (H*W*8); vector<vector<int>> S(H+1, vector<int>(W+1)); for (int i=0; i<K; i++){ S[h][w] ^= 1; if (1 <= h+x && h+x <= H) h = h+x; else x *= -1; if (1 <= w+y && w+y <= W) w = w+y; else y *= -1; } for (int i=1; i<=H; i++){ for (int j=1; j<=W; j++) cout << (S[i][j] ? '#' : '.'); cout << endl; } return 0; }