結果

問題 No.459 C-VS for yukicoder
ユーザー chaemonchaemon
提出日時 2016-12-10 01:02:40
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 3,992 bytes
コンパイル時間 939 ms
コンパイル使用メモリ 90,404 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-19 06:41:02
合計ジャッジ時間 3,835 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 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,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 22 ms
4,376 KB
testcase_22 AC 19 ms
4,380 KB
testcase_23 AC 21 ms
4,376 KB
testcase_24 AC 9 ms
4,380 KB
testcase_25 AC 5 ms
4,380 KB
testcase_26 AC 5 ms
4,376 KB
testcase_27 AC 4 ms
4,376 KB
testcase_28 AC 4 ms
4,380 KB
testcase_29 AC 9 ms
4,380 KB
testcase_30 AC 4 ms
4,376 KB
testcase_31 AC 5 ms
4,376 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 5 ms
4,376 KB
testcase_34 AC 6 ms
4,380 KB
testcase_35 AC 3 ms
4,380 KB
testcase_36 AC 7 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 6 ms
4,380 KB
testcase_39 AC 2 ms
4,380 KB
testcase_40 AC 5 ms
4,380 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 5 ms
4,380 KB
testcase_43 AC 7 ms
4,380 KB
testcase_44 AC 2 ms
4,376 KB
testcase_45 AC 3 ms
4,376 KB
testcase_46 AC 3 ms
4,376 KB
testcase_47 AC 2 ms
4,380 KB
testcase_48 AC 7 ms
4,380 KB
testcase_49 AC 3 ms
4,380 KB
testcase_50 AC 5 ms
4,376 KB
testcase_51 AC 2 ms
4,376 KB
testcase_52 AC 4 ms
4,380 KB
testcase_53 AC 2 ms
4,376 KB
testcase_54 AC 6 ms
4,380 KB
testcase_55 AC 3 ms
4,376 KB
testcase_56 AC 5 ms
4,376 KB
testcase_57 AC 2 ms
4,380 KB
testcase_58 AC 6 ms
4,376 KB
testcase_59 AC 3 ms
4,380 KB
testcase_60 AC 4 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘IO& operator<<(IO&, const std::string&)’ 内:
main.cpp:74:1: 警告: 非 void を戻す関数内に return 文がありません [-Wreturn-type]
   74 | }
      | ^

ソースコード

diff #

// #includes {{{
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <cmath>
using namespace std;
// }}}
// pre-written code {{{
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair
//#define PB push_back
#define CLEAR(c,d) memset((c),(d),sizeof(c))
#define TO_STRING(VariableName) # VariableName
//#define DB(c) cout<<TO_STRING(c)<<"="<<(c)<<endl

#define EXIST(e,s) ((s).find(e)!=(s).end())
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define debug2(x) cerr << #x << " = [";REP(__ind,(x).size()){cerr << (x)[__ind] << ", ";}cerr << "] (L" << __LINE__ << ")" << endl;

#define clr(a) memset((a),0,sizeof(a))
#define nclr(a) memset((a),-1,sizeof(a))
#define pb push_back

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

typedef pair<int,int> pii;
//{{{ io
struct IO{ }io;//dummy
#define endl "\n"
IO& operator>>(IO &io,int &n){scanf("%d",&n);return io;}
IO& operator>>(IO &io,unsigned int &n){scanf("%u",&n);return io;}
IO& operator>>(IO &io,long long &n){scanf("%lld",&n);return io;}
IO& operator>>(IO &io,unsigned long long &n){scanf("%llu",&n);return io;}
IO& operator>>(IO &io,double &n){scanf("%lf",&n);return io;}
IO& operator>>(IO &io,long double &n){scanf("%Lf",&n);return io;}
IO& operator>>(IO &io,char *c){scanf("%s",c);return io;}
IO& operator>>(IO &io,string &s){
    char c;s.clear();
    while(isspace(c=getc(stdin))){if(c==-1)return io;}
    do{
        s.push_back(c);
    }while(!isspace(c=getc(stdin)));
    if(c!=-1)ungetc(c,stdin);
    return io;
}
IO& operator<<(IO &io,const int &n){printf("%d",n);return io;}
IO& operator<<(IO &io,const unsigned int &n){printf("%u",n);return io;}
IO& operator<<(IO &io,const long long &n){printf("%lld",n);return io;}
IO& operator<<(IO &io,const unsigned long long &n){printf("%llu",n);return io;}
IO& operator<<(IO &io,const double &n){printf("%lf",n);return io;}
IO& operator<<(IO &io,const long double &n){printf("%Lf",n);return io;}
IO& operator<<(IO &io,const char c[]){printf("%s",c);return io;}
IO& operator<<(IO &io,const string &s){
    REP(i,s.size())putc(s[i],stdout);
}
//}}}
// }}}

int ct[10010],bl[10010],C[30010],ans[30010][3];
vector<pii> v;


int main(){
	int H,W,N;
	cin>>H>>W>>N;
	memset(ct,0,sizeof(ct));
	memset(ans,0,sizeof(ans));
	memset(bl,0,sizeof(bl));
	string S;
	REP(i,H){
		cin>>S;
		REP(j,W)if(S[j]=='#')ct[j]++;
	}
	REP(i,N){
		int c;
		cin>>c;
		v.push_back(make_pair(c,i));
		bl[c]++,bl[c+1]++,bl[c+2]++;
	}
	sort(ALL(v));
	/*
	REP(i,W)cout<<ct[i]<<" ";
	cout<<endl;
	*/
	REP(i,N){
		int c = v[i].first;
		int p = 0;
		bl[c]--;bl[c+1]--;bl[c+2]--;
		REP(j,3){
			int t = c+j;
			assert(ct[t]<=bl[t]*3+3);
			if(ct[t]>=bl[t]*3+1){
				ans[v[i].second][j]=ct[t]-bl[t]*3;
			}else{
				ans[v[i].second][j]=0;
			}
			ct[t]-=ans[v[i].second][j];
			p+=ans[v[i].second][j];
		}
		if(p==0){
			REP(j,3){
				int t = c+j;
				if(ct[t]>0){
					ans[v[i].second][j]++;
					ct[t]--;
					break;
				}
				if(j==2)assert(false);
			}
		}
		/*
		cout<<"ans: ";
		REP(j,3)cout<<ans[i][j]<<" ";
		cout<<endl;
		REP(j,W)cout<<ct[j]<<" ";
		cout<<endl;
		REP(j,W)cout<<bl[j]<<" ";
		cout<<endl;
		*/
	}
	/*
	REP(ct,N){
		REP(i,3)cout<<ans[ct][i]<<" ";
		cout<<endl;
	}
	*/
	REP(ct,N){
		REP(i,3){
			REP(j,3){
				if(i<ans[ct][j]){
					cout<<"#";
				}else{
					cout<<".";
				}
			}
			cout<<endl;
		}
	}

	return 0;
}
0