結果

問題 No.459 C-VS for yukicoder
ユーザー vjudge1
提出日時 2025-06-23 11:29:25
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,162 bytes
コンパイル時間 2,591 ms
コンパイル使用メモリ 172,248 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-06-23 11:29:34
合計ジャッジ時間 8,240 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38 WA * 17 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e4+5;
int h,w,n;
char c;
int a[N],p[N];
bool f[N];
char ans[N][4][4];
int tp[N][4];
struct T{
	int id,l;
	bool operator <(const T&x) const{
		return f[id]>f[x.id];
	}
};
priority_queue<T> b[N];
T x[N];
signed main(){
//	freopen("tetris.in","r",stdin);
//	freopen("tetris.out","w",stdout);
	cin>>h>>w>>n;
	for (int i=1;i<=h;i++){
		for (int j=1;j<=w;j++){
			cin>>c;
			if(c=='#') a[j]++;
		}
	}
	for (int i=1;i<=n;i++){
		cin>>p[i]; p[i]++;
		b[p[i]].push({i,1});
		for (int j=1;j<=3;j++){
			for (int k=1;k<=3;k++){
				ans[i][j][k]='.';
			}
		}
	}
	for (int i=1;i<=w;i++){
		int cnt=0;
		while(!b[i].empty()){
			x[++cnt]=b[i].top();
			if(x[cnt].l!=3) b[i+1].push({x[cnt].id,x[cnt].l+1});
			b[i].pop();
		}
		for (int j=1;j<=cnt;j++) b[i].push(x[j]);
		for (int j=1;j<=a[i];j++){
			int id=b[i].top().id,l=b[i].top().l;
			b[i].pop();
			ans[id][++tp[id][l]][l]='#';
			f[id]=1;
			if(tp[id][l]!=3){
				b[i].push({id,l});
			}
		}
	}
	for (int i=1;i<=n;i++){
		for (int j=1;j<=3;j++){
			for (int k=1;k<=3;k++){
				cout<<ans[i][j][k];
			}
			cout<<'\n';
		}
	}
	return 0;
} 
0