結果
| 問題 | No.307 最近色塗る問題多くない? |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2015-11-27 23:30:55 |
| 言語 | C90(gcc12) (gcc 12.4.0) |
| 結果 |
AC
|
| 実行時間 | 141 ms / 4,000 ms |
| コード長 | 500 bytes |
| 記録 | |
| コンパイル時間 | 372 ms |
| コンパイル使用メモリ | 30,376 KB |
| 最終ジャッジ日時 | 2026-02-23 19:55:45 |
|
ジャッジサーバーID (参考情報) |
judge2 / 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:3: warning: data definition has no type or storage class
1 | h;w;t;c;d;
| ^
main.c:1:5: warning: data definition has no type or storage class
1 | h;w;t;c;d;
| ^
main.c:1:7: warning: data definition has no type or storage class
1 | h;w;t;c;d;
| ^
main.c:1:9: warning: data definition has no type or storage class
1 | h;w;t;c;d;
| ^
main.c:2:1: warning: data definition has no type or storage class
2 | f[200][200];
| ^
main.c: In function ‘z’:
main.c:17:6: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
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: In function ‘main’:
main.c:39:25: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
39 | printf("%d%c",t<h*w?f[y][x]:d,x==w-1?10:32);
| ^~~~~~
main.c:39:25: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
ソースコード
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