# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
82668 | zubec | Art Class (IOI13_artclass) | C++14 | 126 ms | 66560 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;
typedef long double ld;
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
const ld masOld[4] = {1513845.7449595534, 2878621.1179153402, 7651413.4723624049, 511293.3441765782};
const ld mas[4] = {1506183.0103572895, 2592183.2318885794, 8236725.3572605042, 481440.2991297710};
int a[510][510];
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
for (int i = 0; i < H; i++){
for (int j = 0; j < W; j++){
a[i][j] = (R[i][j]<<16)+(G[i][j]<<8)+B[i][j];
}
}
ld ans = 0;
for (int i = 0; i < H; i++){
for (int j = 0; j < W; j++){
for (int k = 0; k < 4; k++){
int ii = i + dx[k], jj = j + dy[k];
if (ii < 0 || jj < 0 || ii >= H || jj >= W)
continue;
ans += abs(a[i][j]-a[ii][jj]);
}
}
}
ans /= (ld)(H*W);
ld mn = 1e15;
int intAns = 0;
for (int i = 0; i < 4; i++){
if (abs(ans-mas[i]) < mn){
mn = abs(ans-mas[i]);
intAns = i;
}
}
return intAns+1;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |