結果

問題 No.2432 Flip and Move
ユーザー karinohito
提出日時 2024-09-17 00:25:20
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 720 bytes
コンパイル時間 2,101 ms
コンパイル使用メモリ 199,148 KB
最終ジャッジ日時 2025-02-24 08:59:06
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#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";
    }
    
    
}



0