Submission #769630

# Submission time Handle Problem Language Result Execution time Memory
769630 2023-06-29T23:14:21 Z fve5 Art Class (IOI13_artclass) C++17
69 / 100
51 ms 9056 KB
#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 <= 220) return 1;
    if (difference <= 400) return 2;
    return 3;
}
# Verdict Execution time Memory Grader output
1 Correct 45 ms 8652 KB Output is correct
2 Correct 45 ms 8256 KB Output is correct
3 Correct 36 ms 7176 KB Output is correct
4 Correct 39 ms 7788 KB Output is correct
5 Correct 35 ms 8176 KB Output is correct
6 Correct 36 ms 8072 KB Output is correct
7 Correct 31 ms 6964 KB Output is correct
8 Correct 39 ms 7832 KB Output is correct
9 Correct 28 ms 5948 KB Output is correct
10 Incorrect 45 ms 8784 KB Output isn't correct
11 Incorrect 31 ms 8024 KB Output isn't correct
12 Correct 35 ms 7864 KB Output is correct
13 Correct 34 ms 7228 KB Output is correct
14 Incorrect 44 ms 8552 KB Output isn't correct
15 Correct 36 ms 7500 KB Output is correct
16 Correct 37 ms 7624 KB Output is correct
17 Correct 20 ms 5396 KB Output is correct
18 Incorrect 40 ms 8244 KB Output isn't correct
19 Correct 28 ms 6544 KB Output is correct
20 Correct 44 ms 8844 KB Output is correct
21 Correct 32 ms 8012 KB Output is correct
22 Correct 29 ms 6700 KB Output is correct
23 Incorrect 37 ms 7712 KB Output isn't correct
24 Correct 36 ms 7176 KB Output is correct
25 Correct 39 ms 7480 KB Output is correct
26 Incorrect 35 ms 7324 KB Output isn't correct
27 Incorrect 29 ms 7784 KB Output isn't correct
28 Correct 40 ms 7440 KB Output is correct
29 Correct 37 ms 7668 KB Output is correct
30 Correct 46 ms 8932 KB Output is correct
31 Correct 31 ms 7792 KB Output is correct
32 Correct 39 ms 8088 KB Output is correct
33 Incorrect 28 ms 6736 KB Output isn't correct
34 Correct 36 ms 8132 KB Output is correct
35 Correct 51 ms 9056 KB Output is correct
36 Correct 41 ms 8344 KB Output is correct
37 Correct 35 ms 7992 KB Output is correct
38 Correct 25 ms 7628 KB Output is correct
39 Incorrect 40 ms 8204 KB Output isn't correct
40 Correct 35 ms 7100 KB Output is correct
41 Incorrect 20 ms 5540 KB Output isn't correct
42 Correct 38 ms 8208 KB Output is correct
43 Incorrect 45 ms 8724 KB Output isn't correct
44 Correct 37 ms 7688 KB Output is correct
45 Correct 36 ms 7404 KB Output is correct
46 Correct 28 ms 7472 KB Output is correct
47 Incorrect 33 ms 7184 KB Output isn't correct
48 Correct 45 ms 8204 KB Output is correct
49 Correct 38 ms 8280 KB Output is correct
50 Correct 35 ms 7292 KB Output is correct
51 Correct 36 ms 8160 KB Output is correct
52 Incorrect 23 ms 5988 KB Output isn't correct
53 Correct 23 ms 6048 KB Output is correct
54 Correct 30 ms 7884 KB Output is correct
55 Incorrect 34 ms 7276 KB Output isn't correct
56 Incorrect 44 ms 8760 KB Output isn't correct
57 Correct 39 ms 8156 KB Output is correct
58 Correct 43 ms 8644 KB Output is correct
59 Correct 36 ms 7260 KB Output is correct
60 Correct 38 ms 8180 KB Output is correct
61 Correct 45 ms 8796 KB Output is correct
62 Correct 29 ms 7588 KB Output is correct
63 Correct 33 ms 7756 KB Output is correct
64 Correct 45 ms 8720 KB Output is correct
65 Correct 46 ms 8780 KB Output is correct
66 Incorrect 10 ms 4296 KB Output isn't correct
67 Correct 23 ms 7240 KB Output is correct
68 Correct 40 ms 8284 KB Output is correct
69 Correct 37 ms 8016 KB Output is correct
70 Correct 37 ms 8352 KB Output is correct
71 Correct 35 ms 7616 KB Output is correct
72 Correct 32 ms 7744 KB Output is correct
73 Correct 38 ms 8372 KB Output is correct
74 Correct 24 ms 5964 KB Output is correct
75 Correct 46 ms 8336 KB Output is correct
76 Incorrect 42 ms 7700 KB Output isn't correct
77 Correct 29 ms 7628 KB Output is correct
78 Correct 33 ms 8000 KB Output is correct
79 Correct 29 ms 7696 KB Output is correct
80 Correct 37 ms 8396 KB Output is correct
81 Correct 39 ms 8564 KB Output is correct
82 Correct 42 ms 7332 KB Output is correct
83 Incorrect 37 ms 8200 KB Output isn't correct
84 Correct 29 ms 6672 KB Output is correct
85 Correct 39 ms 8652 KB Output is correct
86 Incorrect 45 ms 7128 KB Output isn't correct
87 Correct 39 ms 8168 KB Output is correct
88 Incorrect 38 ms 8196 KB Output isn't correct
89 Correct 44 ms 8760 KB Output is correct
90 Correct 36 ms 8120 KB Output is correct
91 Incorrect 35 ms 7928 KB Output isn't correct
92 Correct 38 ms 7800 KB Output is correct
93 Correct 45 ms 8896 KB Output is correct
94 Correct 41 ms 7372 KB Output is correct
95 Correct 37 ms 8276 KB Output is correct
96 Correct 12 ms 6612 KB Output is correct
97 Correct 29 ms 7596 KB Output is correct
98 Correct 39 ms 7732 KB Output is correct
99 Incorrect 19 ms 5324 KB Output isn't correct
100 Incorrect 26 ms 6164 KB Output isn't correct
101 Incorrect 43 ms 8584 KB Output isn't correct
102 Correct 27 ms 7580 KB Output is correct