# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
597381 | skittles1412 | Art Class (IOI13_artclass) | C++17 | 54 ms | 5984 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 "bits/extc++.h"
using namespace std;
template <typename T>
void dbgh(const T& t) {
cerr << t << endl;
}
template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
cerr << t << " | ";
dbgh(u...);
}
#ifdef DEBUG
#define dbg(...) \
cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \
dbgh(__VA_ARGS__);
#else
#define dbg(...)
#define cerr \
if (false) \
cerr
#endif
#define endl "\n"
#define long int64_t
#define sz(x) int((x).size())
extern "C" int style(int n,
int m,
int r[500][500],
int g[500][500],
int b[500][500]) {
cerr << fixed << setprecision(5);
auto eq = [&](int a, int b, int x) -> bool {
return abs(a - b) <= x;
};
auto req = [&](int x1, int y1, int x2, int y2, int x) -> bool {
return eq(r[x1][y1], r[x2][y2], x) && eq(g[x1][y1], g[x2][y2], x) &&
eq(b[x1][y1], b[x2][y2], x);
};
{
auto f1 = [&](int x) -> int {
int ans = 0;
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < m - 1; j++) {
ans += req(i, j, i, j + 1, x) + req(i + 1, j, i, j, x);
}
}
return ans;
};
int x2 = 0, x3 = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
int csum = r[i][j] + b[i][j] + g[i][j];
x2 += csum >= 700;
x3 += csum <= 50;
}
}
double d1 = double(f1(10)) / (2 * n * m), d2 = double(x2) / (n * m),
d3 = double(f1(20)) / (n * m), d4 = double(f1(20)) / (2 * n * m);
cerr << d1 << " " << d2 << " " << d3 << endl;
if (d1 > 0.9) {
if (d2 > 0.05) {
return 1;
} else {
return 4;
}
} else if (d1 > 0.5 && d2 > 0.05) {
return 1;
} else if (d1 > 0.5 || d2 < 1e-3) {
return 2;
} else {
return 3;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |