# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
769630 | fve5 | Art Class (IOI13_artclass) | C++17 | 51 ms | 9056 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |