結果
| 問題 |
No.3261 yiwiy9 → yiwiY9
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-08 16:31:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 1,799 bytes |
| コンパイル時間 | 2,139 ms |
| コンパイル使用メモリ | 194,108 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2025-09-08 16:31:36 |
| 合計ジャッジ時間 | 3,613 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 29 |
ソースコード
#include<bits/stdc++.h>
//#include<atcoder/all>
using namespace std;
//using namespace atcoder;
using ll = long long;
using ld = long double;
//using mint = modint; //mint::set_mod(M);
//using mint = modint998244353;
//using mint = modint1000000007;
template<class T> using pq = priority_queue<T>; //大きい順
template<class T> using pq_g = priority_queue<T, vector<T>, greater<T>>; //小さい順
#define vec_unique(v) v.erase(unique(v.begin(), v.end()), v.end()) //重複削除
#define vec_iota(v) iota(v.begin(), v.end(), 0) //0, 1, 2, 3, ..., n - 1にセット
#define concat(a, b) a.insert(a.end(), b.begin(), b.end())
#define debug(x) cerr << #x << " = " << x << endl
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
//int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
#define INF 2e18
#define INF2 2e9
int main() {
int h, w;
cin >> h >> w;
vector<string> s(h);
for(int i = 0; i < h; i++) {
cin >> s[i];
}
bool check = false;
bool hand = false;
for(int i = 0; i < h; i++) {
for(int j = 0; j < w; j++) {
if(s[i][j] == 'y' && !check && !hand) {
check = true;
} else if(s[i][j] == 'y' && check && !hand) {
hand = true;
s[i][j] = 'Y';
} else if(s[i][j] == 'y' && check && hand) {
check = false;
hand = false;
} else if(s[i][j] == '9' && check && hand) {
check = false;
hand = false;
} else if(s[i][j] == '9' && !check && !hand) {
check = true;
}
}
}
for(int i = 0; i < h; i++) {
cout << s[i] << endl;
}
//cout << fixed << setprecision(15) << << endl;
return 0;
}