Submission #00051


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include<bits/stdc++.h>
using namespace std;
int w,h;
int n;
int mas[10000][10000];
int dx[] = {-1,1,0,0};
int dy[] = {0,0,1,-1};
void solve(int x,int y){
mas[y][x] = 1;
for(int i=0;i<4;i++){
int nx = x + dx[i];
int ny = y + dy[i];
if(nx >= 0 && ny >= 0 && nx < w && ny < h && mas[ny][nx] == 0){
solve(nx,ny);
}
}
}
int main(){
cin >> w >> h;
cin >> n;
memset(mas,0,sizeof(mas));
for(int i=0;i<n;i++){
int a,b,c,d; cin >> a >> b >> c >> d;
for(int k=b;k<d;k++){
for(int j=a;j<c;j++){
mas[k][j] = 1;
}
}
}
int cnt = 0;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(mas[i][j] == 0){
solve(j,i);
cnt++;
}
}
}
cout << cnt << endl;
}

ステータス

項目 データ
問題 0005 - ペンキの色
ユーザー名 ei1428
投稿日時 2016-02-09 18:58:45
言語 C++11
状態 Memory Limit Exceeded
得点 0
ソースコード長 767 Byte
最大実行時間 1000 ms
最大メモリ使用量 65536 KB

セット

セット 得点 Cases
1 INPUT1 0 / 5 *in01
2 INPUT2 0 / 5 *in02
3 INPUT3 0 / 5 *in03
4 INPUT4 0 / 5 *in04
5 INPUT5 0 / 5 *in05
6 INPUT6 0 / 5 *in06
7 INPUT7 0 / 5 *in07
8 INPUT8 0 / 5 *in08
9 INPUT9 0 / 5 *in09
10 INPUT10 0 / 5 *in10
11 INPUT11 0 / 5 *in11
12 INPUT12 0 / 5 *in12
13 INPUT13 0 / 5 *in13
14 INPUT14 0 / 5 *in14
15 INPUT15 0 / 5 *in15
16 INPUT16 0 / 5 *in16
17 INPUT17 0 / 5 *in17
18 INPUT18 0 / 5 *in18
19 INPUT19 0 / 5 *in19
20 INPUT20 0 / 5 *in20

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
2008-ho-t5-in01 MLE 1000 ms 65536 KB
1
2008-ho-t5-in02 MLE 1000 ms 65536 KB
2
2008-ho-t5-in03 MLE 1000 ms 65536 KB
3
2008-ho-t5-in04 MLE 1000 ms 65536 KB
4
2008-ho-t5-in05 MLE 1000 ms 65536 KB
5
2008-ho-t5-in06 MLE 1000 ms 65536 KB
6
2008-ho-t5-in07 MLE 1000 ms 65536 KB
7
2008-ho-t5-in08 MLE 1000 ms 65536 KB
8
2008-ho-t5-in09 MLE 1000 ms 65536 KB
9
2008-ho-t5-in10 MLE 1000 ms 65536 KB
10
2008-ho-t5-in11 MLE 1000 ms 65536 KB
11
2008-ho-t5-in12 MLE 1000 ms 65536 KB
12
2008-ho-t5-in13 MLE 1000 ms 65536 KB
13
2008-ho-t5-in14 MLE 1000 ms 65536 KB
14
2008-ho-t5-in15 MLE 1000 ms 65536 KB
15
2008-ho-t5-in16 MLE 1000 ms 65536 KB
16
2008-ho-t5-in17 MLE 1000 ms 65536 KB
17
2008-ho-t5-in18 MLE 1000 ms 65536 KB
18
2008-ho-t5-in19 MLE 1000 ms 65536 KB
19
2008-ho-t5-in20 MLE 1000 ms 65536 KB
20