Submission #769635

# Submission time Handle Problem Language Result Execution time Memory
769635 2023-06-29T23:47:46 Z fve5 Art Class (IOI13_artclass) C++17
96 / 100
61 ms 6176 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]) {
    
    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] };

    double difference = 0.;
    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 <= 85) return 4;
    if (difference >= 400) return 3;
    
    double greens = 0.;

    for (int i = 0; i < H; i++)
        for (int j = 0; j < H; j++)
            greens += G[i][j];
    
    greens /= (H * W);

    if (greens >= 110) return 1;
    return 2;
}
# Verdict Execution time Memory Grader output
1 Correct 29 ms 5068 KB Output is correct
2 Correct 38 ms 6136 KB Output is correct
3 Correct 46 ms 6072 KB Output is correct
4 Correct 38 ms 6032 KB Output is correct
5 Correct 45 ms 6136 KB Output is correct
6 Incorrect 19 ms 4432 KB Output isn't correct
7 Correct 38 ms 6072 KB Output is correct
8 Correct 30 ms 6084 KB Output is correct
9 Correct 30 ms 4936 KB Output is correct
10 Correct 31 ms 4664 KB Output is correct
11 Correct 38 ms 6160 KB Output is correct
12 Correct 45 ms 6028 KB Output is correct
13 Correct 35 ms 6144 KB Output is correct
14 Correct 29 ms 6140 KB Output is correct
15 Incorrect 33 ms 5324 KB Output isn't correct
16 Correct 33 ms 6128 KB Output is correct
17 Correct 43 ms 6104 KB Output is correct
18 Correct 39 ms 5044 KB Output is correct
19 Correct 36 ms 5380 KB Output is correct
20 Correct 50 ms 6176 KB Output is correct
21 Correct 40 ms 5628 KB Output is correct
22 Correct 37 ms 5528 KB Output is correct
23 Correct 29 ms 6096 KB Output is correct
24 Correct 37 ms 5572 KB Output is correct
25 Incorrect 37 ms 6084 KB Output isn't correct
26 Correct 45 ms 6092 KB Output is correct
27 Correct 24 ms 4716 KB Output is correct
28 Correct 38 ms 5488 KB Output is correct
29 Correct 35 ms 5588 KB Output is correct
30 Correct 50 ms 5328 KB Output is correct
31 Correct 31 ms 4612 KB Output is correct
32 Correct 37 ms 6072 KB Output is correct
33 Correct 35 ms 5580 KB Output is correct
34 Correct 37 ms 6112 KB Output is correct
35 Correct 39 ms 5736 KB Output is correct
36 Correct 29 ms 6108 KB Output is correct
37 Correct 44 ms 6092 KB Output is correct
38 Incorrect 31 ms 4772 KB Output isn't correct
39 Correct 45 ms 6068 KB Output is correct
40 Correct 37 ms 5452 KB Output is correct
41 Correct 37 ms 6104 KB Output is correct
42 Correct 27 ms 6116 KB Output is correct
43 Correct 45 ms 6056 KB Output is correct
44 Incorrect 45 ms 6092 KB Output isn't correct
45 Correct 36 ms 6044 KB Output is correct
46 Correct 30 ms 4996 KB Output is correct
47 Correct 35 ms 6056 KB Output is correct
48 Correct 47 ms 5752 KB Output is correct
49 Correct 58 ms 6152 KB Output is correct
50 Correct 38 ms 5540 KB Output is correct
51 Correct 39 ms 6084 KB Output is correct
52 Correct 37 ms 6028 KB Output is correct
53 Correct 36 ms 6096 KB Output is correct
54 Incorrect 20 ms 4416 KB Output isn't correct
55 Incorrect 46 ms 6132 KB Output isn't correct
56 Correct 30 ms 4620 KB Output is correct
57 Correct 41 ms 5068 KB Output is correct
58 Correct 46 ms 5676 KB Output is correct
59 Correct 38 ms 5664 KB Output is correct
60 Correct 35 ms 5392 KB Output is correct
61 Correct 35 ms 5400 KB Output is correct
62 Correct 38 ms 6144 KB Output is correct
63 Correct 37 ms 5580 KB Output is correct
64 Correct 12 ms 6172 KB Output is correct
65 Correct 30 ms 6052 KB Output is correct
66 Incorrect 43 ms 6084 KB Output isn't correct
67 Correct 58 ms 6152 KB Output is correct
68 Correct 44 ms 6060 KB Output is correct
69 Correct 32 ms 6092 KB Output is correct
70 Correct 57 ms 6116 KB Output is correct
71 Correct 35 ms 5448 KB Output is correct
72 Correct 45 ms 6160 KB Output is correct
73 Incorrect 10 ms 3796 KB Output isn't correct
74 Correct 49 ms 6088 KB Output is correct
75 Correct 35 ms 5452 KB Output is correct
76 Correct 35 ms 5508 KB Output is correct
77 Correct 36 ms 6092 KB Output is correct
78 Correct 34 ms 5332 KB Output is correct
79 Correct 38 ms 6092 KB Output is correct
80 Correct 42 ms 6108 KB Output is correct
81 Correct 37 ms 6144 KB Output is correct
82 Correct 19 ms 4424 KB Output is correct
83 Correct 35 ms 6136 KB Output is correct
84 Correct 36 ms 5508 KB Output is correct
85 Correct 41 ms 5628 KB Output is correct
86 Correct 37 ms 5588 KB Output is correct
87 Correct 44 ms 5348 KB Output is correct
88 Correct 61 ms 6100 KB Output is correct
89 Correct 38 ms 6064 KB Output is correct
90 Correct 29 ms 6148 KB Output is correct
91 Correct 38 ms 6144 KB Output is correct
92 Correct 40 ms 6104 KB Output is correct
93 Incorrect 38 ms 6064 KB Output isn't correct
94 Incorrect 36 ms 6140 KB Output isn't correct
95 Correct 31 ms 6088 KB Output is correct
96 Correct 38 ms 6040 KB Output is correct
97 Correct 53 ms 5932 KB Output is correct
98 Correct 47 ms 6132 KB Output is correct
99 Correct 35 ms 6100 KB Output is correct
100 Correct 25 ms 6140 KB Output is correct
101 Correct 41 ms 5392 KB Output is correct
102 Incorrect 40 ms 5740 KB Output isn't correct