結果
問題 | No.307 最近色塗る問題多くない? |
ユーザー | satos___jp |
提出日時 | 2015-11-27 22:59:06 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,282 bytes |
コンパイル時間 | 501 ms |
コンパイル使用メモリ | 65,084 KB |
実行使用メモリ | 69,452 KB |
最終ジャッジ日時 | 2023-10-12 00:22:26 |
合計ジャッジ時間 | 6,734 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,536 KB |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | AC | 2 ms
4,352 KB |
testcase_03 | AC | 2 ms
4,352 KB |
testcase_04 | AC | 2 ms
4,352 KB |
testcase_05 | AC | 2 ms
4,352 KB |
testcase_06 | AC | 2 ms
4,352 KB |
testcase_07 | AC | 436 ms
4,348 KB |
testcase_08 | TLE | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
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 | -- | - |
ソースコード
#include<cstdio> #include<cstring> #include<vector> #include<queue> #include<algorithm> #include<cmath> #include<climits> #include<string> #include<set> #include<map> using namespace std; #define rep(i,n) for(int i=0;i<((int)(n));i++) #define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++) #define irep(i,n) for(int i=((int)(n))-1;i>=0;i--) #define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--) typedef long long int lli; typedef pair<int,int> mp; #define fir first #define sec second #define IINF INT_MAX #define LINF LLONG_MAX int h,w; int dat[205][205]; int gone[205][205]; int dd[5]={1,0,-1,0,1}; void nur(int y,int x,int c){ if(gone[y][x])return; gone[y][x]=1; rep(i,4){ int tx=x+dd[i], ty=y+dd[i+1]; if(tx<0 || tx>=w || ty<0 || ty>=h)continue; if(dat[ty][tx]==dat[y][x])nur(ty,tx,c); } dat[y][x]=c; } int main(void){ scanf("%d%d",&h,&w); rep(y,h){ rep(x,w){ scanf("%d",&dat[y][x]); } } int qqq; scanf("%d",&qqq); rep(i,qqq){ int y,x,c; scanf("%d%d%d",&y,&x,&c); y--; x--; if(dat[y][x]==c)continue; memset(gone,0,sizeof(gone)); nur(y,x,c); /* rep(y,h){ rep(x,w){ printf("%d%c",dat[y][x],x+1==w?'\n':' '); } } */ } rep(y,h){ rep(x,w){ printf("%d%c",dat[y][x],x+1==w?'\n':' '); } } return 0; }