# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
518860 | SHZhang | Art Class (IOI13_artclass) | C++14 | 164 ms | 8276 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 <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
double dis(int a, int b, int c, int d, int e, int f)
{
return (double)((a-d)*(a-d) + (b-e)*(b-e) + (c-f)*(c-f));
}
bool used[16][16][16];
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
double var = 0.0;
vector<double> varvec;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
//used[R[i][j] / 16][G[i][j] / 16][B[i][j] / 16] = true;
double tot = 0.0; int cnt = 0;
for (int k = -5; k <= 5; k++) {
for (int l = -5; l <= 5; l++) {
if (i + k >= 0 && i + k < H && j + l >= 0 && j + l < W) {
tot += dis(R[i][j], G[i][j], B[i][j], R[i+k][j+l],
G[i+k][j+l], B[i+k][j+l]);
cnt++;
}
}
}
var += tot / (double)cnt;
varvec.push_back(tot / (double)cnt);
}
}
sort(varvec.begin(), varvec.end());
/*int usecnt = 0;
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) {
for (int k = 0; k < 16; k++) {
if (used[i][j][k]) usecnt++;
}
}
}*/
double varavg = var / (double)(H*W);
double varlowmed = varvec[(H*W)/3];
if (varlowmed <= 435.0) {
if (varavg <= 1400.0) return 4;
return 1;
} else {
if (varlowmed + varavg <= 8000.0) return 2;
return 3;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |