# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
389938 | rainboy | Art Class (IOI13_artclass) | C11 | 66 ms | 6036 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 <stdio.h>
#include <string.h>
int abs_(int a) { return a > 0 ? a : -a; }
int style(int n, int m, int rr[500][500], int gg[500][500], int bb[500][500]) {
static int pp[768];
int i, j, d;
double sameness, contrast;
memset(pp, 0, sizeof pp);
contrast = 0;
for (i = 0; i < n; i++)
for (j = 1; j < m; j++) {
int r = rr[i][j] - rr[i][j - 1];
int g = gg[i][j] - gg[i][j - 1];
int b = bb[i][j] - bb[i][j - 1];
int d = abs_(r) + abs_(g) + abs_(b);
pp[d]++;
contrast += d;
}
for (i = 1; i < n; i++)
for (j = 0; j < m; j++) {
int r = rr[i][j] - rr[i - 1][j];
int g = gg[i][j] - gg[i - 1][j];
int b = bb[i][j] - bb[i - 1][j];
int d = abs_(r) + abs_(g) + abs_(b);
pp[d]++;
contrast += d;
}
sameness = 0;
for (d = 0; d < 10; d++)
sameness += pp[d];
contrast /= n * (m - 1) + (n - 1) * m;
sameness /= n * (m - 1) + (n - 1) * m;
if (contrast < 10)
return 4;
if (contrast > 50)
return 3;
return sameness < 0.4 ? 2 : 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |