結果
問題 |
No.307 最近色塗る問題多くない?
|
ユーザー |
|
提出日時 | 2015-11-29 01:30:00 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 581 bytes |
コンパイル時間 | 379 ms |
コンパイル使用メモリ | 40,704 KB |
実行使用メモリ | 12,444 KB |
最終ジャッジ日時 | 2024-09-14 05:02:15 |
合計ジャッジ時間 | 6,314 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 TLE * 1 -- * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:17:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%d%d",&H,&W); | ~~~~~^~~~~~~~~~~~~~ main.cpp:22:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 22 | scanf("%d",&a[h][w]); | ~~~~~^~~~~~~~~~~~~~~ main.cpp:26:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | for(scanf("%d",&Q);Q--;){ | ~~~~~^~~~~~~~~ main.cpp:27:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 27 | scanf("%d%d%d",&R,&C,&X); | ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include <vector> #include <cstdio> using namespace std; vector<vector<int> >a; void dfs(int x,int y,int c){ if(x<0||a[0].size()<=x || y<0||a.size()<=y || a[y][x]==c)return; a[y][x]=c; dfs(x-1,y,c); dfs(x+1,y,c); dfs(x,y-1,c); dfs(x,y+1,c); } int main(){ int H,W; scanf("%d%d",&H,&W); a.resize(H); for(int h=0;h<H;h++){ a[h].resize(W); for(int w=0;w<W;w++){ scanf("%d",&a[h][w]); } } int Q,R,C,X; for(scanf("%d",&Q);Q--;){ scanf("%d%d%d",&R,&C,&X); R--,C--; dfs(C,R,X); } for(int h=0;h<H;h++)for(int w=0;w<W;w++)printf(w<W-1?"%d ":"%d\n",a[h][w]); }