# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1174480 | Lithanium | Art Class (IOI13_artclass) | C++20 | 53 ms | 4328 KiB |
#include <bits/stdc++.h>
#include "artclass.h"
using namespace std;
int dt[505][505];
int getR(int RGB) { return (RGB >> 16) & 0xFF; }
int getG(int RGB) { return (RGB >> 8) & 0xFF; }
int getB(int RGB) { return RGB & 0xFF; }
int diff(int v1, int v2) {
return abs(getR(v1) - getR(v2)) + abs(getG(v1) - getG(v2)) + abs(getB(v1) - getB(v2));
}
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
double stuff = 0;
for (int i = 1; i <= H; i ++) {
for (int j = 1; j <= W; j ++) {
dt[i][j] = ((R[i-1][j-1] << 8) + G[i-1][j-1]) << 8 + B[i-1][j-1];
if (i > 1) stuff += diff(dt[i][j], dt[i-1][j]);
if (j > 1) stuff += diff(dt[i][j], dt[i][j-1]);
}
}
stuff /= (double)H*W - H - W + 1;
if (stuff < 20) return 4;
else if (stuff < 46) return 1;
else if (stuff < 105) return 2;
else return 3;
// cout << test << ": " << stuff << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |