結果
| 問題 |
No.2432 Flip and Move
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-18 23:49:10 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 137 ms / 2,000 ms |
| コード長 | 1,010 bytes |
| コンパイル時間 | 2,154 ms |
| コンパイル使用メモリ | 171,780 KB |
| 実行使用メモリ | 65,792 KB |
| 最終ジャッジ日時 | 2024-11-28 11:29:02 |
| 合計ジャッジ時間 | 5,551 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> istream& operator >> (istream& is, vector<T>& vec) {
for(T& x : vec) is >> x;
return is;
}
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) {
if(vec.empty()) return os;
os << vec[0];
for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it;
return os;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int h, w;
ll k;
cin >> h >> w >> k;
vector<int> y(2 * h), x(2 * w);
iota(y.begin(), y.begin() + h, 0);
iota(y.rbegin(), y.rbegin() + h, 0);
iota(x.begin(), x.begin() + w, 0);
iota(x.rbegin(), x.rbegin() + w, 0);
k %= 2 * h * w;
vector<vector<int>> A(h, vector<int>(w));
for(int i = 0; i < k; i++){
A[y[i % y.size()]][x[i % x.size()]] ^= 1;
}
for(int y = 0; y < h; y++){
for(int x = 0; x < w; x++){
cout << (A[y][x] ? '#' : '.');
}
cout << '\n';
}
}