#include <bits/stdc++.h>
#include "artclass.h"
using namespace std;
int diff(array<int, 3> a, array<int, 3> b) {
return abs(a[0] - b[0]) + abs(a[1] - b[1]) + abs(a[2] - b[2]);
}
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
double difference = 0.;
array<int, 3> img[500][500];
for (int i = 0; i < H; i++)
for (int j = 0; j < H; j++)
img[i][j] = { R[i][j], G[i][j], B[i][j] };
for (int i = 1; i < H - 1; i++) {
for (int j = 1; j < W - 1; j++) {
difference += diff(img[i][j], img[i - 1][j - 1])
+ diff(img[i][j], img[i - 1][j ])
+ diff(img[i][j], img[i - 1][j + 1])
+ diff(img[i][j], img[i ][j + 1])
+ diff(img[i][j], img[i + 1][j + 1])
+ diff(img[i][j], img[i + 1][j ])
+ diff(img[i][j], img[i + 1][j - 1])
+ diff(img[i][j], img[i ][j - 1]);
}
}
difference /= (H * W);
if (difference <= 75) return 4;
if (difference >= 400) return 3;
int cnt = 0;
for (int i = 0; i < H; i++) {
for (int j = 0; j < H; j++) {
if (R[i][j] > 230) {
cnt++;
}
}
}
if ((double)cnt / (H * W) > 0.05) return 1;
return 2;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
6056 KB |
Output is correct |
2 |
Correct |
34 ms |
5448 KB |
Output is correct |
3 |
Correct |
36 ms |
6144 KB |
Output is correct |
4 |
Incorrect |
38 ms |
5820 KB |
Output isn't correct |
5 |
Correct |
35 ms |
6028 KB |
Output is correct |
6 |
Correct |
42 ms |
6084 KB |
Output is correct |
7 |
Correct |
35 ms |
6092 KB |
Output is correct |
8 |
Correct |
28 ms |
6056 KB |
Output is correct |
9 |
Correct |
35 ms |
5488 KB |
Output is correct |
10 |
Correct |
22 ms |
6100 KB |
Output is correct |
11 |
Correct |
28 ms |
6128 KB |
Output is correct |
12 |
Correct |
39 ms |
5712 KB |
Output is correct |
13 |
Correct |
23 ms |
4652 KB |
Output is correct |
14 |
Correct |
34 ms |
5452 KB |
Output is correct |
15 |
Incorrect |
31 ms |
6088 KB |
Output isn't correct |
16 |
Correct |
29 ms |
6100 KB |
Output is correct |
17 |
Incorrect |
35 ms |
6148 KB |
Output isn't correct |
18 |
Correct |
28 ms |
6108 KB |
Output is correct |
19 |
Correct |
36 ms |
6092 KB |
Output is correct |
20 |
Correct |
38 ms |
5700 KB |
Output is correct |
21 |
Correct |
45 ms |
6168 KB |
Output is correct |
22 |
Correct |
35 ms |
6100 KB |
Output is correct |
23 |
Incorrect |
10 ms |
3796 KB |
Output isn't correct |
24 |
Incorrect |
35 ms |
5496 KB |
Output isn't correct |
25 |
Correct |
34 ms |
6124 KB |
Output is correct |
26 |
Correct |
34 ms |
5420 KB |
Output is correct |
27 |
Incorrect |
19 ms |
4372 KB |
Output isn't correct |
28 |
Incorrect |
46 ms |
5836 KB |
Output isn't correct |
29 |
Correct |
35 ms |
6040 KB |
Output is correct |
30 |
Incorrect |
41 ms |
6084 KB |
Output isn't correct |
31 |
Correct |
30 ms |
6112 KB |
Output is correct |
32 |
Correct |
24 ms |
4692 KB |
Output is correct |
33 |
Correct |
45 ms |
6048 KB |
Output is correct |
34 |
Correct |
25 ms |
6100 KB |
Output is correct |
35 |
Incorrect |
39 ms |
5716 KB |
Output isn't correct |
36 |
Correct |
44 ms |
6032 KB |
Output is correct |
37 |
Correct |
44 ms |
5996 KB |
Output is correct |
38 |
Correct |
35 ms |
6104 KB |
Output is correct |
39 |
Correct |
35 ms |
5452 KB |
Output is correct |
40 |
Correct |
41 ms |
5460 KB |
Output is correct |
41 |
Incorrect |
46 ms |
6148 KB |
Output isn't correct |
42 |
Correct |
34 ms |
6092 KB |
Output is correct |
43 |
Correct |
28 ms |
6144 KB |
Output is correct |
44 |
Correct |
44 ms |
6080 KB |
Output is correct |
45 |
Correct |
33 ms |
5324 KB |
Output is correct |
46 |
Correct |
43 ms |
6100 KB |
Output is correct |
47 |
Correct |
28 ms |
4972 KB |
Output is correct |
48 |
Correct |
37 ms |
6032 KB |
Output is correct |
49 |
Correct |
36 ms |
6124 KB |
Output is correct |
50 |
Correct |
39 ms |
6116 KB |
Output is correct |
51 |
Correct |
33 ms |
5352 KB |
Output is correct |
52 |
Correct |
28 ms |
5068 KB |
Output is correct |
53 |
Correct |
37 ms |
6036 KB |
Output is correct |
54 |
Correct |
34 ms |
5372 KB |
Output is correct |
55 |
Correct |
40 ms |
5960 KB |
Output is correct |
56 |
Incorrect |
20 ms |
4448 KB |
Output isn't correct |
57 |
Correct |
35 ms |
6120 KB |
Output is correct |
58 |
Correct |
37 ms |
5604 KB |
Output is correct |
59 |
Correct |
33 ms |
5324 KB |
Output is correct |
60 |
Correct |
43 ms |
6068 KB |
Output is correct |
61 |
Correct |
45 ms |
6136 KB |
Output is correct |
62 |
Correct |
37 ms |
6092 KB |
Output is correct |
63 |
Incorrect |
36 ms |
6152 KB |
Output isn't correct |
64 |
Correct |
36 ms |
5576 KB |
Output is correct |
65 |
Correct |
37 ms |
5588 KB |
Output is correct |
66 |
Correct |
23 ms |
4716 KB |
Output is correct |
67 |
Correct |
37 ms |
6092 KB |
Output is correct |
68 |
Incorrect |
44 ms |
6148 KB |
Output isn't correct |
69 |
Correct |
35 ms |
5460 KB |
Output is correct |
70 |
Correct |
28 ms |
5128 KB |
Output is correct |
71 |
Correct |
30 ms |
6100 KB |
Output is correct |
72 |
Correct |
30 ms |
5076 KB |
Output is correct |
73 |
Correct |
40 ms |
5644 KB |
Output is correct |
74 |
Correct |
36 ms |
6092 KB |
Output is correct |
75 |
Correct |
36 ms |
5472 KB |
Output is correct |
76 |
Correct |
37 ms |
5640 KB |
Output is correct |
77 |
Correct |
35 ms |
5452 KB |
Output is correct |
78 |
Correct |
34 ms |
6120 KB |
Output is correct |
79 |
Incorrect |
37 ms |
6132 KB |
Output isn't correct |
80 |
Correct |
38 ms |
6140 KB |
Output is correct |
81 |
Incorrect |
33 ms |
5320 KB |
Output isn't correct |
82 |
Correct |
45 ms |
6084 KB |
Output is correct |
83 |
Correct |
36 ms |
5620 KB |
Output is correct |
84 |
Correct |
24 ms |
4628 KB |
Output is correct |
85 |
Incorrect |
25 ms |
4864 KB |
Output isn't correct |
86 |
Incorrect |
44 ms |
6036 KB |
Output isn't correct |
87 |
Correct |
31 ms |
6056 KB |
Output is correct |
88 |
Correct |
28 ms |
6128 KB |
Output is correct |
89 |
Correct |
35 ms |
5428 KB |
Output is correct |
90 |
Correct |
12 ms |
6132 KB |
Output is correct |
91 |
Correct |
44 ms |
6128 KB |
Output is correct |
92 |
Correct |
44 ms |
6088 KB |
Output is correct |
93 |
Correct |
28 ms |
5012 KB |
Output is correct |
94 |
Correct |
26 ms |
6168 KB |
Output is correct |
95 |
Correct |
36 ms |
5580 KB |
Output is correct |
96 |
Correct |
19 ms |
4416 KB |
Output is correct |
97 |
Correct |
38 ms |
6060 KB |
Output is correct |
98 |
Correct |
32 ms |
6084 KB |
Output is correct |
99 |
Correct |
31 ms |
6116 KB |
Output is correct |
100 |
Correct |
45 ms |
6088 KB |
Output is correct |
101 |
Correct |
40 ms |
6048 KB |
Output is correct |
102 |
Incorrect |
29 ms |
6112 KB |
Output isn't correct |