# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1012618 | DorostWef | Art Class (IOI13_artclass) | C++17 | 0 ms | 0 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.
#pragma once
#include <bits/stdc++.h>
using namespace std;
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
int white = 0;
int green = 0;
int dif = 0;
int r = 0, g = 0, b = 0;
int dif2 = 0;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if (R[i][j] <= 20 && G[i][j] <= 20 && B[i][j] <= 20) {
white++;
}
if (G[i][j] >= 100 && R[i][j] >= 80 && B[i][j] <= 80) {
green++;
}
r += R[i][j];
g += G[i][j];
b += B[i][j];
if (j != 0) {
int x = abs(R[i][j] - R[i][j - 1]) + abs(G[i][j] - G[i][j - 1]) + abs(B[i][j] - B[i][j - 1]);
if (x >= 60) {
dif ++;
}
if (x >= 88)
dif2++;
}
if (i != 0) {
int x = abs(R[i][j] - R[i - 1][j]) + abs(G[i][j] - G[i - 1][j]) + abs(B[i][j] - B[i - 1][j]);
if (x >= 60) {
dif ++;
}
if (x >= 88)
dif2++;
}
}
}
r /= H;
g /= H;
b /= H;
r /= W;
g /= W;
b /= W;
double wef = (double)dif / (double)(H * W);
double few = (double)dif2 / (double)(H * W);
double gg = (double)green / (double)(H * W);
double ww = (double)white / (double)(H * W);
//cout << few << ' ' << few + gg << '\n';
// cout << gg << ' ' << wef << ' ' << few << ' ' << ww << '\n';
if (wef <= 0.039)
return 4;
if (wef >= 0.62)
return 3;
if (few / wef >= 0.58)
return 1;
return 2;
// cout << white << ' ' << green << '\n';
// cout << r << ' ' << g << ' ' << b << '\n';
if (abs (green - white) <= H * W / 17) {
return 1;
}
if (green > white)
return 2;
if (r >= 120)
return 4;
return 3;
}