結果
| 問題 |
No.2946 Puyo
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-26 13:08:28 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 54 ms / 2,000 ms |
| コード長 | 672 bytes |
| コンパイル時間 | 2,236 ms |
| コンパイル使用メモリ | 201,808 KB |
| 最終ジャッジ日時 | 2025-02-25 00:17:45 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 45 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
#include <atcoder/dsu>
using namespace atcoder;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int h,w;
cin >> h >> w;
vector<string>a(h);
rep(i,h)cin>>a[i];
dsu uf(h*w);
rep(i,h){
rep(j,w){
if(i!=h-1 && a[i][j]==a[i+1][j]) uf.merge(i*w+j,(i+1)*w+j);
if(j!=w-1 && a[i][j]==a[i][j+1]) uf.merge(i*w+j,i*w+j+1);
}
}
rep(i,h){
rep(j,w){
if(uf.size(i*w+j)>=4) a[i][j] = '.';
cout << a[i][j];
}
cout << endl;
}
}