結果
| 問題 | 
                            No.307 最近色塗る問題多くない?
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tails
                         | 
                    
| 提出日時 | 2015-11-27 23:30:55 | 
| 言語 | C90  (gcc 12.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 228 ms / 4,000 ms | 
| コード長 | 500 bytes | 
| コンパイル時間 | 538 ms | 
| コンパイル使用メモリ | 21,376 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-21 21:50:36 | 
| 合計ジャッジ時間 | 2,910 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 36 | 
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | h;w;t;c;d;
      | ^
main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘h’ [-Wimplicit-int]
main.c:1:3: warning: data definition has no type or storage class
    1 | h;w;t;c;d;
      |   ^
main.c:1:3: warning: type defaults to ‘int’ in declaration of ‘w’ [-Wimplicit-int]
main.c:1:5: warning: data definition has no type or storage class
    1 | h;w;t;c;d;
      |     ^
main.c:1:5: warning: type defaults to ‘int’ in declaration of ‘t’ [-Wimplicit-int]
main.c:1:7: warning: data definition has no type or storage class
    1 | h;w;t;c;d;
      |       ^
main.c:1:7: warning: type defaults to ‘int’ in declaration of ‘c’ [-Wimplicit-int]
main.c:1:9: warning: data definition has no type or storage class
    1 | h;w;t;c;d;
      |         ^
main.c:1:9: warning: type defaults to ‘int’ in declaration of ‘d’ [-Wimplicit-int]
main.c:2:1: warning: data definition has no type or storage class
    2 | f[200][200];
      | ^
main.c:2:1: warning: type defaults to ‘int’ in declaration of ‘f’ [-Wimplicit-int]
main.c:4:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    4 | g(x,y){
      | ^
main.c: In function ‘g’:
main.c:4:1: warning: type of ‘x’ defaults to ‘int’ [-Wimplicit-int]
main.c:4:1: warning: type of ‘y’ defaults to ‘int’ [-Wimplicit-int]
main.c: At top level:
main.c:17:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
   17 | z(x){scanf("%d",&x);return x;}
      | ^
main.c: In function ‘z’:
main.c:17:1: warning: type of ‘x’ defaults to ‘int’ [-Wimplicit-int]
main.c:17:6: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
   17 | z(x){scanf("%d",&x);return x;}
      |      ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | h;w;t;c;d;
main.c:17:6: warning: incompatible implicit de
            
            ソースコード
h;w;t;c;d;
f[200][200];
g(x,y){
	if(x>=0&&x<w&&y>=0&&y<h){
		if(f[y][x]==c){
			f[y][x]=d;
			++t;
			g(x-1,y);
			g(x+1,y);
			g(x,y-1);
			g(x,y+1);
		}
	}
}
z(x){scanf("%d",&x);return x;}
main(x,y,q){
	h=z();w=z();
	for(y=0;y<h;++y){
		for(x=0;x<w;++x){
			f[y][x]=z();
		}
	}
	q=z();
	while(q--){
		y=z()-1;x=z()-1;d=z();
		if(t<h*w && f[y][x]!=d){
			t=0;
			c=1-d;
			g(x,y);
		}
	}
	for(y=0;y<h;++y){
		for(x=0;x<w;++x){
			printf("%d%c",t<h*w?f[y][x]:d,x==w-1?10:32);
		}
	}
	return 0;
}
            
            
            
        
            
tails