結果
| 問題 |
No.307 最近色塗る問題多くない?
|
| コンテスト | |
| ユーザー |
h_noson
|
| 提出日時 | 2016-06-19 21:45:02 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,036 bytes |
| コンパイル時間 | 654 ms |
| コンパイル使用メモリ | 64,472 KB |
| 実行使用メモリ | 13,640 KB |
| 最終ジャッジ日時 | 2024-10-11 12:54:40 |
| 合計ジャッジ時間 | 7,918 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 TLE * 2 -- * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:34:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
34 | scanf("%d%d",&h,&w);
| ~~~~~^~~~~~~~~~~~~~
main.cpp:35:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
35 | rep (i,h) rep (j,w) scanf("%d",&a[i][j]);
| ~~~~~^~~~~~~~~~~~~~~
main.cpp:38:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
38 | scanf("%d",&q);
| ~~~~~^~~~~~~~~
main.cpp:41:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
41 | scanf("%d%d%d",&r,&c,&x);
| ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
#define REP(i,s,e) for (i = s; i <= e; i++)
#define rep(i,n) REP (i,0,(int)(n)-1)
#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP (i,(int)(n)-1,0)
#define INF (int)1e8
#define MOD (int)(1e9+7)
typedef long long ll;
int a[200][200];
int h, w;
void dfs(int r, int c, int x) {
a[r][c] = x;
int i;
int dxy[] = {1,0,-1,0};
rep (i,4) {
int nr = r + dxy[i];
int nc = c + dxy[(i+1)%4];
if (nr < 0 || nr >= h || nc < 0 || nc >= w) continue;
if (a[nr][nc] != x)
dfs(nr,nc,x);
}
}
int main(void) {
int i, j;
scanf("%d%d",&h,&w);
rep (i,h) rep (j,w) scanf("%d",&a[i][j]);
int q;
scanf("%d",&q);
while (q--) {
int r, c, x;
scanf("%d%d%d",&r,&c,&x);
r--; c--;
if (a[r][c] != x) dfs(r,c,x);
}
rep (i,h) {
rep (j,w)
printf("%d ",a[i][j]);
printf("\n");
}
return 0;
}
h_noson