# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
369328 | kostia244 | Art Class (IOI13_artclass) | C++17 | 103 ms | 17900 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<bits/stdc++.h>
using namespace std;
using ld = long double;
const int maxn = 500;
using vec = array<ld, 3>;
const vec green = {0, 255, 0};
const vec white = {255, 255, 255};
ld dif(vec a, vec b) {
ld t = 0;
for(int i = 0; i < 3; i++)
t += (a[i]-b[i])*(a[i]-b[i]);
return sqrt(t);
}
int n, m;
vec img[maxn][maxn];
ld sharpness() {
ld sum = 0;
for(int i = 0; i+1 < n; i++)
for(int j = 0; j < m; j++)
sum += dif(img[i][j], img[i+1][j]);
for(int i = 0; i < n; i++)
for(int j = 0; j+1 < m; j++)
sum += dif(img[i][j], img[i][j+1]);
sum /= n*(m-1) + (n-1)*m;
return sum;
}
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
n = H, m = W;
for(int i = 0; i < n; i++)
for(int j = 0; j < m; j++) {
img[i][j] = {max(1,R[i][j]),max(1,G[i][j]),max(1,B[i][j])};
}
ld f = sharpness();
if(f > 30.) return 3;
if(f < 5.) return 4;
return 2;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |