# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
765322 | kekw_orz | Art Class (IOI13_artclass) | C++14 | 86 ms | 12796 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 long ll;
typedef pair<ll, ll> pll;
typedef long double ld;
#define X first
#define Y second
#define sep ' '
#define debug(x) cerr << #x << ": " << x << endl;
const ll MAXN = 500;
const ld GRTRFACTOR = 0.6;
const ld difflim = 200;
int n, m, A[MAXN][MAXN][3];
vector<pll> adj[MAXN][MAXN];
inline ld dist(int a, int b, int x, int y) {
ld ans = 0;
for (int i = 0; i < 3; i++)
ans += pow(abs(A[a][b][i] - A[x][y][i]), 1);
return ans;
}
inline int wow() {
int ans = 0;
for (int i = 0; i < n / 20; i++) {
for (int j = 0; j < m / 20; j++) {
bool flag = true;
for (int a = 0; a < 20; a++) {
for (int b = 0; b < 20; b++) {
if (dist(i, j, i + a, j + b) > difflim)
flag = false;
}
}
ans += flag;
}
}
return ans;
}
inline int horz_khat() {
int fans = 0;
for (int i = 20; i < n; i++) {
int ans = 0;
for (int j = 0; j < m; j++)
if (dist(i, j, i - 20, j) > difflim)
ans++;
if (ans > 0.7 * m) fans++;
}
return fans;
}
inline int vert_khat() {
int fans = 0;
for (int i = 20; i < m; i++) {
int ans = 0;
for (int j = 0; j < n; j++)
if (dist(j, i, j, i - 20) > difflim)
ans++;
if (ans > 0.7 * n) fans++;
}
return fans;
}
inline ld green_sum() {
ld s = 0;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
s = s + A[i][j][1] - A[i][j][0] - A[i][j][2];
s /= (n * m);
return s;
}
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++)
A[i][j][0] = R_[i][j], A[i][j][1] = G_[i][j], A[i][j][2] = B_[i][j];
debug(vert_khat())
debug(horz_khat())
debug(wow())
if (max(vert_khat(), horz_khat()) > 3 && min(vert_khat(), horz_khat()) < 2) return 4;
if (green_sum() >= -70) return 2;
if (vert_khat() + horz_khat() == 0) return 3;
if (wow() > 100) return 1;
return 3;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |