結果

問題 No.459 C-VS for yukicoder
ユーザー imulanimulan
提出日時 2016-12-10 00:46:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,635 bytes
コンパイル時間 1,773 ms
コンパイル使用メモリ 171,944 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-28 20:44:18
合計ジャッジ時間 11,395 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 58
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int main()
{
    int h,w,n;
    cin >>h >>w >>n;
    vector<string> s(h);
    rep(i,h) cin >>s[i];
    vector<int> c(n);
    rep(i,n) cin >>c[i];

    // その列に積み上がっているブロックの個数
    vector<int> num(w);
    rep(x,w)
    {
        rep(y,h)
        {
            if(s[y][x]=='#')
            {
                num[x]=h-y;
                break;
            }
        }
    }

    rep(i,w) printf("num[%d]= %d\n", i,num[i]);

    // その列にブロックを落とせる回数
    vector<int> ct(w,0);
    rep(i,n)rep(j,3) ++ct[c[i]+j];

    rep(i,n)
    {
        int b[3]={};
        bool all_zero=true;
        rep(j,3)
        {
            if((ct[c[i]+j]-1)*3 < num[c[i]+j])
            {
                b[j] = num[c[i]+j]-(ct[c[i]+j]-1)*3;
                all_zero=false;
            }
        }

        if(all_zero)
        {
            rep(j,3)
            {
                if(num[c[i]+j] >= ct[c[i]+j])
                {
                    b[j]=1;
                    break;
                }
            }
        }

        rep(j,3)
        {
            rep(k,3)
            {
                if(j<b[k]) printf("#");
                else printf(".");
            }
            printf("\n");
        }

        rep(j,3) --ct[c[i]+j];
        rep(j,3) num[c[i]+j]-=b[j];
    }

    return 0;
}
0