結果
| 問題 |
No.459 C-VS for yukicoder
|
| コンテスト | |
| ユーザー |
ytft
|
| 提出日時 | 2021-04-02 22:07:28 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 133 ms / 2,000 ms |
| コード長 | 1,584 bytes |
| コンパイル時間 | 1,789 ms |
| コンパイル使用メモリ | 176,480 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-23 19:37:25 |
| 合計ジャッジ時間 | 6,023 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 58 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int H,W,N;
cin>>H>>W>>N;
vector<int> height(W);
string S;
for(int i=0;i<H;++i){
cin>>S;
for(int j=W-1;j>=0;--j){
height[j]+=(S[j]=='#');
}
}
vector<vector<int>> position(W-2,vector<int>(0));
int temp;
for(int i=0;i<N;++i){
cin>>temp;
position[temp].push_back(i);
}
vector<vector<int>> ans(N,vector<int>(3));
vector<bool> isPut(N,false);
for(int i=0;i<W;++i){
if(height[i]==0){
goto end;
}
for(int j=max(0,i-2);j<=min(W-3,i);++j){
for(int k:position[j]){
if(!isPut[k]){
++ans[k][i-j];
isPut[k]=true;
--height[i];
if(!height[i]){
goto end;
}
}
}
}
for(int j=max(0,i-2);j<=min(W-3,i);++j){
for(int k:position[j]){
isPut[k]=true;
temp=min(ans[k][i-j]+height[i],3);
height[i]-=temp-ans[k][i-j];
ans[k][i-j]=temp;
if(!height[i]){
goto end;
}
}
}
end:{}
}
for(int i=0;i<N;i++){
for(int j=0;j<3;j++){
for(int k=0;k<3;k++){
if(ans[i][k]>j){
cout<<'#';
}else{
cout<<'.';
}
}
cout<<endl;
}
}
}
ytft