結果

問題 No.459 C-VS for yukicoder
ユーザー どららどらら
提出日時 2016-12-10 01:32:15
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,324 bytes
コンパイル時間 795 ms
コンパイル使用メモリ 83,184 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-19 06:50:23
合計ジャッジ時間 6,865 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 111 ms
4,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 13 ms
4,380 KB
testcase_26 AC 15 ms
4,380 KB
testcase_27 AC 13 ms
4,380 KB
testcase_28 AC 14 ms
4,380 KB
testcase_29 AC 40 ms
4,376 KB
testcase_30 AC 16 ms
4,376 KB
testcase_31 WA -
testcase_32 AC 1 ms
4,380 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 3 ms
4,380 KB
testcase_36 AC 29 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 WA -
testcase_39 AC 3 ms
4,376 KB
testcase_40 WA -
testcase_41 AC 2 ms
4,384 KB
testcase_42 AC 17 ms
4,380 KB
testcase_43 AC 24 ms
4,380 KB
testcase_44 WA -
testcase_45 AC 5 ms
4,380 KB
testcase_46 AC 4 ms
4,380 KB
testcase_47 AC 3 ms
4,376 KB
testcase_48 AC 26 ms
4,380 KB
testcase_49 AC 2 ms
4,380 KB
testcase_50 WA -
testcase_51 AC 2 ms
4,376 KB
testcase_52 WA -
testcase_53 AC 4 ms
4,380 KB
testcase_54 WA -
testcase_55 AC 9 ms
4,376 KB
testcase_56 AC 19 ms
4,380 KB
testcase_57 AC 1 ms
4,380 KB
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;


int main(){
  ios::sync_with_stdio(false);
  int H, W, N;
  cin >> H >> W >> N;
  vector<string> v;
  vector<int> w;
  rep(i,H){
    string s;
    cin >> s;
    v.push_back(s);
  }
  rep(i,N){
    int a;
    cin >> a;
    w.push_back(a);
  }
  vector<int> num(W+5,0);
  rep(i,H){
    rep(j,W){
      if(v[i][j]=='#') num[j]++;
    }
  }
  
  vector<int> cnt(W+5,0);
  rep(i,N){
    cnt[w[i]]++;
    cnt[w[i]+1]++;
    cnt[w[i]+2]++;
  }

  rep(i,N){
    int p1 = w[i];
    int p2 = w[i]+1;
    int p3 = w[i]+2;

    int ret1 = 0, ret2 = 0, ret3 = 0;
    bool f1 = false, f2 = false, f3 = false;
    if(num[p1] < cnt[p1]) f1 = true;
    if(num[p2] < cnt[p2]) f2 = true;
    if(num[p3] < cnt[p3]) f3 = true;

    if(f1 && f2 && f3){
      if(num[p1]>0) ret1++;
      else if(num[p2]>0) ret2++;
      else ret3++;
    }else{
      if(num[p1]>0){
        if(num[p1] >= cnt[p1]) ret1 = min(3,(num[p1] + cnt[p1]-1)/cnt[p1]);
        else ret1 = 1;
      }
      if(num[p2]>0){
        if(num[p2] >= cnt[p2]) ret2 = min(3,(num[p2] + cnt[p2]-1)/cnt[p2]);
        else ret2 = 1;
      }
      if(num[p3]>0){
        if(num[p3] >= cnt[p3]) ret3 = min(3,(num[p3] + cnt[p3]-1)/cnt[p3]);
        else ret3 = 1;
      }
    }


    if(ret1>=3) cout << "#"; else cout << ".";
    if(ret2>=3) cout << "#"; else cout << ".";
    if(ret3>=3) cout << "#"; else cout << ".";
    cout << endl;
    if(ret1>=2) cout << "#"; else cout << ".";
    if(ret2>=2) cout << "#"; else cout << ".";
    if(ret3>=2) cout << "#"; else cout << ".";
    cout << endl;
    if(ret1>=1) cout << "#"; else cout << ".";
    if(ret2>=1) cout << "#"; else cout << ".";
    if(ret3>=1) cout << "#"; else cout << ".";
    cout << endl;

    num[p1] -= ret1; cnt[p1]--;
    num[p2] -= ret2; cnt[p2]--;
    num[p3] -= ret3; cnt[p3]--;

  }
  
  
  return 0;
}
0