結果

問題 No.459 C-VS for yukicoder
ユーザー YamyukiYamyuki
提出日時 2016-12-10 15:21:22
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,361 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 25,388 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-08-19 09:25:12
合計ジャッジ時間 4,843 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,032 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 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 0 ms
4,380 KB
testcase_08 AC 0 ms
4,376 KB
testcase_09 AC 0 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,384 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>

int w,n,result[10000],border[10000];

typedef struct{
	int ans[3];
	int order;
	int id;
} block;

block c[30000];

int cmp(const void*,const void*);
int cmp_id(const void*,const void*);

int main(){
	int h,i,j,now;
	char s;
	scanf("%d %d %d",&h,&w,&n);
	getchar();
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			scanf("%c",&s);
			if(s=='#'){
				result[j]++;
			}
		}
		getchar();
	}
	for(i=0;i<n;i++){
		scanf("%d",&c[i].order);
		c[i].id=i;
	}
	qsort(c,n,sizeof(block),cmp);
	i=0;
	j=0;
	while(i<w-2){
		if(c[j].order!=i){
			border[i]=j;
			i++;
		}else if(j>=n){
			break;
		}else{
			j++;
		}
	}
	for(i=0;i<w;i++){
		while(result[i]>0){
			if(now<n && c[now].order<=i){
				if(c[now].ans[i-c[now].order]<3){
					c[now].ans[i-c[now].order]++;
					result[i]--;
				}
				now++;
			}else{
				if(i>2){
					now=border[i-3];
				}else{
					now=0;
				}
			}
		}
	}
	qsort(c,n,sizeof(block),cmp_id);
	for(i=0;i<n;i++){
		for(j=0;j<3;j++){
			if(c[i].ans[0]>=3-j) printf("#");
			else printf(".");
			if(c[i].ans[1]>=3-j) printf("#");
			else printf(".");
			if(c[i].ans[2]>=3-j) printf("#");
			else printf(".");
			printf("\n");
		}
	}
	return 0;
}

int cmp(const void* a,const void* b){
	return ((block *)a)->order-((block *)b)->order;
}

int cmp_id(const void *a,const void *b){
	return ((block*)a)->id-((block*)b)->id;
}
0