結果
問題 |
No.3261 yiwiy9 → yiwiY9
|
ユーザー |
![]() |
提出日時 | 2025-09-06 13:39:09 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 1,532 bytes |
コンパイル時間 | 4,398 ms |
コンパイル使用メモリ | 253,608 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-06 13:40:06 |
合計ジャッジ時間 | 5,502 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll = long long; constexpr ll mod = 1e9 + 7; constexpr ll INF = (1LL << 62) - (1LL << 31) - 1; #define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++) #define RREP(i, init, n) for(int i = (int)(init); i >= (int)(n); i--) #define All(A) A.begin(), A.end() #define rAll(A) A.rbegin(), A.rend() #define vi vector<int> #define vl vector<long> #define vvi vector<vector<int>> #define vvl vector<vector<long>> #define pint pair<int, int> #define plong pair<long, long> int H, W; vector<string> S; void solve() { vvi visited(H, vi(W, 0)); REP(i, 0, H) { REP(j, 0, W) { if(visited[i][j]) continue; if(S[i][j] == '9') { if(j - 5 >= 0 && S[i][j - 1] == 'y' && visited[i][j - 1] == 0) { S[i][j - 1] = 'Y'; S[i][j - 5] = 'y'; REP(k, 0, 6) { visited[i][j - k] = 1; } } else if(j + 1 < W && S[i][j + 1] == 'y') { S[i][j + 1] = 'Y'; S[i][j + 5] = 'y'; REP(k, 0, 6) { visited[i][j + k] = 1; } } } } } REP(i, 0, H) { cout << S[i] << endl; } } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cin >> H >> W; S.resize(H); REP(i, 0, H) cin >> S[i]; solve(); }