# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
383509 | ParsaAlizadeh | Art Class (IOI13_artclass) | C++17 | 89 ms | 4080 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 pair<int, int> pii;
#define all(x) x.begin(), x.end()
#define kill(x) return cout << x << endl, 0
#define X first
#define Y second
#define endl '\n'
#define debug(x) #x << " : " << x << " / "
constexpr ll pw(ll a, ll b, ll mod) {
return (!b ? 1 :
b & 1 ? a * pw(a * a % mod, b / 2, mod) % mod :
pw(a * a % mod, b / 2, mod));
}
constexpr int N = 1e5 + 10;
struct HSV {
double h, s, v;
HSV(double r, double g, double b) {
r /= 255; g /= 255; b /= 255;
double cmax = max({r, g, b}), cmin = min({r ,g, b}), d = cmax - cmin;
v = cmax * 100;
h = (
cmax == cmin ? 0 :
cmax == r ? (double) 60 * fmod((g - b) / d, 6) :
cmax == g ? (double) 60 * ((b - r) / d + 2) :
(double) 60 * ((r - g) / d + 4)
);
s = (
cmax == 0 ? 0 :
d * 100 / cmax
);
}
};
double twh, tgr, tbl, trd;
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++) {
HSV cur = {R[i][j], G[i][j], B[i][j]};
if (35 <= cur.h && cur.h <= 200 && cur.s >= 30 && cur.v >= 30)
tgr++;
if ((cur.h <= 25 || 340 <= cur.h) && cur.s >= 30 && cur.v >= 30)
trd++;
if (cur.v <= 30)
tbl++;
if (cur.s <= 30)
twh++;
}
}
twh = twh * 100 / W / H;
tgr = tgr * 100 / W / H;
tbl = tbl * 100 / W / H;
trd = trd * 100 / W / H;
if (trd >= 19)
return 4;
if (tgr >= 40)
return 2;
if (tbl >= 21)
return 3;
return 1;
cout << setprecision(2) << fixed;
cout << debug(tgr) << debug(trd) << debug(tbl) << debug(twh) << endl;
return 1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |