結果

問題 No.459 C-VS for yukicoder
ユーザー rickythetarickytheta
提出日時 2016-12-10 00:35:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,011 ms / 2,000 ms
コード長 1,763 bytes
コンパイル時間 1,563 ms
コンパイル使用メモリ 153,172 KB
実行使用メモリ 100,808 KB
最終ジャッジ日時 2023-08-19 06:32:20
合計ジャッジ時間 6,664 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,508 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1,011 ms
4,380 KB
testcase_22 AC 37 ms
100,808 KB
testcase_23 AC 31 ms
6,472 KB
testcase_24 AC 307 ms
4,380 KB
testcase_25 AC 66 ms
4,384 KB
testcase_26 AC 28 ms
100,380 KB
testcase_27 AC 5 ms
6,096 KB
testcase_28 AC 66 ms
4,380 KB
testcase_29 AC 29 ms
100,504 KB
testcase_30 AC 28 ms
100,368 KB
testcase_31 AC 50 ms
4,380 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 111 ms
4,380 KB
testcase_34 AC 108 ms
4,384 KB
testcase_35 AC 2 ms
4,388 KB
testcase_36 AC 10 ms
4,376 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 101 ms
4,380 KB
testcase_39 AC 3 ms
4,376 KB
testcase_40 AC 31 ms
4,380 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 14 ms
4,380 KB
testcase_43 AC 61 ms
4,376 KB
testcase_44 AC 7 ms
4,380 KB
testcase_45 AC 5 ms
4,376 KB
testcase_46 AC 3 ms
4,376 KB
testcase_47 AC 3 ms
4,380 KB
testcase_48 AC 64 ms
4,376 KB
testcase_49 AC 2 ms
4,384 KB
testcase_50 AC 83 ms
4,376 KB
testcase_51 AC 2 ms
4,380 KB
testcase_52 AC 14 ms
4,376 KB
testcase_53 AC 4 ms
4,376 KB
testcase_54 AC 103 ms
4,380 KB
testcase_55 AC 4 ms
4,380 KB
testcase_56 AC 22 ms
4,380 KB
testcase_57 AC 2 ms
4,380 KB
testcase_58 AC 92 ms
4,380 KB
testcase_59 AC 7 ms
4,376 KB
testcase_60 AC 13 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int h,w,n;
char s[12525][12525];
int c[35353];

int cc[12525];
int v[12525];
int kk[12525];

int tmp[35353][3];

int main(){
  scanf("%d%d%d",&h,&w,&n);
  REP(i,h)scanf("%s",s[i]);
  REP(i,n)scanf("%d",c+i);
  REP(i,w){
    REP(j,h)if(s[j][i]=='#')v[i]++;
  }
  REP(i,n){
    REP(j,3)cc[c[i]+j]++;
  }

  REP(x,w){
    vector<pair<pii,int>> V;
    REP(i,n){
      if(c[i]<=x && x<=c[i]+2){
        int sum = tmp[i][0]+tmp[i][1]+tmp[i][2];
        V.push_back(make_pair(pii(sum,c[i]),i));
      }
    }
    sort(ALL(V));
    for(auto P:V){
      int i = P.second;
      int all = v[x];
      int cnt = cc[x];
      int num = all / cnt;
      if(kk[x] < all%cnt){
        num++;
      }
      kk[x]++;
      tmp[i][x-c[i]] = num;
    }
  }

  REP(i,n){
    REP(y,3){
      REP(x,3)if(tmp[i][x]>0){
        putchar('#');
        tmp[i][x]--;
      }else{
        putchar('.');
      }
      putchar('\n');
    }
  }
  return 0;
}
0