# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1074167 | Ignut | 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.
// Ignut
#include <bits/stdc++.h>
// #include "artclass.h"
using namespace std;
using ll = long long;
using ld = long double;
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
ld avgDiff = 0;
int cntE = 0;
for (int i = 0; i < H; i ++) {
for (int j = 0; j < W - 1; j ++) {
cntE ++;
avgDiff += (R[i][j] - R[i][j + 1]) * (R[i][j] - R[i][j + 1]);
avgDiff += (G[i][j] - G[i][j + 1]) * (G[i][j] - G[i][j + 1]);
avgDiff += (B[i][j] - B[i][j + 1]) * (B[i][j] - B[i][j + 1]);
}
}
for (int i = 0; i < H - 1; i ++) {
for (int j = 0; j < W; j ++) {
cntE ++;
avgDiff += (G[i][j] - G[i + 1][j]) * (G[i][j] - G[i + 1][j]);
avgDiff += (B[i][j] - B[i + 1][j]) * (B[i][j] - B[i + 1][j]);
avgDiff += (R[i][j] - R[i + 1][j]) * (R[i][j] - R[i + 1][j]);
}
}
int avgD = int(avgDiff / cntE);
int avgG = 0;
for (int i = 0; i < H; i ++) {
for (int j = 0; j < W; j ++) {
avgG += 2 * G[i][j] - R[i][j] - B[i][j];
}
}
avgG /= H * W;
if (avgD <= 150) return 4;
if (avgD >= 2000) return 3;
if (avgG >= 20) return 2;
return 1;
// return int(avgDiff / cntE);
}