# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
389855 | rainboy | Art Class (IOI13_artclass) | C11 | 67 ms | 5264 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |