# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
680204 | bashkort | Art Class (IOI13_artclass) | C++17 | 66 ms | 3860 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.
// rainboy
#include <bits/stdc++.h>
#include "artclass.h"
using namespace std;
int style(int n, int m, int R[500][500], int G[500][500], int B[500][500]) {
array<double, 256 * 3> cnt{};
double contrast = 0;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
if (i > 0) {
int d = abs(R[i][j] - R[i - 1][j]) + abs(G[i][j] - G[i - 1][j]) + abs(B[i][j] - B[i - 1][j]);
cnt[d] += 1;
contrast += d;
}
if (j > 0) {
int d = abs(R[i][j] - R[i][j - 1]) + abs(G[i][j] - G[i][j - 1]) + abs(B[i][j] - B[i][j - 1]);
cnt[d] += 1;
contrast += d;
}
}
}
contrast /= n * (m - 1) + m * (n - 1);
double sameness = accumulate(cnt.begin(), cnt.begin() + 10, 0) / double(n * (m - 1) + m * (n - 1));
if (contrast < 10) {
return 4;
} else if (contrast > 60) {
return 3;
}
if (sameness > 0.4) {
return 1;
} else {
return 2;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |