# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
8063 | gs14004 | Art Class (IOI13_artclass) | C++98 | 127 ms | 3616 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 "artclass.h"
#include <cstdlib>
#include <cmath>
#define D(i,j,k,l) (abs(R[i][j] - R[k][l])+abs(G[i][j] - G[k][l])+abs(B[i][j] - B[k][l]))
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
double delta = 0;
int meanR = 0, meanG = 0, meanB = 0, alldev = 0;
int buckR[16] = {}, buckG[16] = {}, buckB[16] = {};
for (int i=0; i<H; i++) {
for (int j=0; j<W; j++) {
meanR += R[i][j];
meanG += G[i][j];
meanB += B[i][j];
buckR[R[i][j]>>4]++;
buckG[G[i][j]>>4]++;
buckB[B[i][j]>>4]++;
}
}
meanR /= H*W*16;
meanG /= H*W*16;
meanB /= H*W*16;
for (int i=0; i<16; i++) {
alldev += buckR[i] * (meanR - i)*(meanR - i);
alldev += buckG[i] * (meanG - i)*(meanG - i);
alldev += buckB[i] * (meanB - i)*(meanB - i);
}
alldev /= 256;
for (int i=0; i<H; i++) {
for (int j=0; j<W-1; j++) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |