結果
問題 | No.2946 Puyo |
ユーザー |
![]() |
提出日時 | 2024-10-25 21:22:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 635 bytes |
コンパイル時間 | 4,371 ms |
コンパイル使用メモリ | 253,272 KB |
最終ジャッジ日時 | 2025-02-24 22:44:16 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 45 |
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000000LL int main(){ int h,w; cin>>h>>w; vector<string> s(h); rep(i,h)cin>>s[i]; dsu D(h*w); rep(i,h){ rep(j,w){ if(j!=w-1 && s[i][j]!='.' && s[i][j]==s[i][j+1])D.merge(i*w+j,i*w+j+1); if(i!=h-1 && s[i][j]!='.' && s[i][j]==s[i+1][j])D.merge(i*w+j,(i+1)*w+j); } } rep(i,h){ rep(j,w){ if(D.size(i*w+j)>=4)s[i][j] = '.'; } } rep(i,h)cout<<s[i]<<endl; return 0; }