結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e4+5;
int h,w,n;
char ch;
int a[N],p[N];
vector<int> b[N];
int c[N][3];
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>>ch;
			if(ch=='#') a[j]++;
		}
	}
	for (int i=1;i<=n;i++){
		cin>>p[i]; p[i]++;
		b[p[i]].push_back(i);
	}
	for (int i=1;i<=w;i++){
		for (int j:b[i]){
			if(a[i]) c[j][0]++,a[i]--;
			else if(a[i+1]) c[j][1]++,a[i+1]--;
			else c[j][2]++,a[i+2]--;
		}
	}
	for (int i=1;i<=w;i++){
		for (int j:b[i]){
			for (int k=0;k<3;k++){
				int now=i+k;
				if(now>w) continue;
				int add=min(3-c[j][k],a[now]);
				c[j][k]+=add;
				a[now]-=add;
			}
		}
	}
	for (int i=1;i<=n;i++){
		for (int j=1;j<=3;j++){
			for (int k=0;k<3;k++){
				if(j<=c[i][k]) cout<<'#';
				else cout<<'.';
			}
			cout<<'\n';
		}
	}
	return 0;
} 
0