結果

問題 No.459 C-VS for yukicoder
ユーザー vjudge1
提出日時 2025-06-21 19:37:07
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 1,573 bytes
コンパイル時間 3,647 ms
コンパイル使用メモリ 282,824 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-06-21 19:37:15
合計ジャッジ時間 6,872 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 58
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define sc second
#define pii pair<int,int>
#define pdd pair<double,double>
#define pb push_back
#define umap unordered_map
#define mset multiset
#define pq priority_queue
#define ull unsigned long long
#define i128 __int128
#define ld long double
#define fixs fixed<<setprecision
const int maxn=1e5+10;
int n,m,k,res[maxn][3],s[maxn];
vector<int> vec[maxn];
void solve(){
    cin>>n>>m>>k;
    for(int i=1;i<=n;i++){
        string str;
        cin>>str,str=" "+str;
        for(int j=1;j<=m;j++) s[j]+=(str[j]=='#');
    }
    for(int i=1,x;i<=k;i++) cin>>x,x++,vec[x].pb(i);
    for(int i=1;i<=m-2;i++){
        for(int x:vec[i]){
            // cout<<x<<endl;
            for(int j:{0,1,2}){
                bool flg=0;
                if(s[i+j]) s[i+j]--,res[x][j]++,flg=1;
                if(flg) break;
            }
        }
    }
    for(int i=1;i<=m;i++){
        for(int j:{0,1,2}){
            if(i-j<=0||i-j>m-2) continue;
            for(int x:vec[i-j]){
                while(s[i]&&res[x][j]<3) s[i]--,res[x][j]++;
            }
        }
    }
    // for(int i=1;i<=k;i++) cout<<res[i][0]<<" "<<res[i][1]<<" "<<res[i][2]<<endl;
    for(int i=1;i<=k;i++){
        for(int y=3;y;y--,cout<<endl){
            for(int x=0;x<3;x++) cout<<(y<=res[i][x]?"#":".");
        }
    }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0;
}
/*
Samples
input:

output:

THINGS TODO:
??freopen???????
????
????????????
*/
0