結果
問題 |
No.2946 Puyo
|
ユーザー |
|
提出日時 | 2024-10-29 22:42:50 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 618 bytes |
コンパイル時間 | 2,189 ms |
コンパイル使用メモリ | 202,244 KB |
最終ジャッジ日時 | 2025-02-25 01:31:26 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 45 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #include<atcoder/dsu> using namespace atcoder; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int H,W; cin>>H>>W; vector<string> S(H); dsu d(H*W); for(int h=0;h<H;h++)cin>>S[h]; for(int h=0;h<H;h++)for(int w=0;w<W;w++){ if(h!=0&&S[h][w]==S[h-1][w])d.merge(h*W+w,(h-1)*W+w); if(w!=0&&S[h][w]==S[h][w-1])d.merge(h*W+w,h*W+w-1); } for(int i=0;i<H;i++){ for(int j=0;j<W;j++){ cout<<(d.size(i*W+j)>=4?'.':S[i][j]); } cout<<endl; } }