| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 8059 | gs14004 | Art Class (IOI13_artclass) | C++98 | 151 ms | 3648 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++) {
double x = sqrt(D(i,j,i,j+1));
if(x > 2.1 )delta += x;
}
}
for (int j=0; j<W; j++) {
for (int i=0; i<H-1; i++) {
double x = sqrt(D(i,j,i+1,j));
if(x > 2.1) delta += x;
}
}
double t = 100.0 * delta / (2 * W * H - H - W);
if(t > 660) return 3;
else if(t > 400) return 2;
else if(t < 130) return 4;
else if(t > 260) return 1;
else{ return alldev > 20000 ? 1 : 4;
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
