Submission #383509

#TimeUsernameProblemLanguageResultExecution timeMemory
383509ParsaAlizadehArt Class (IOI13_artclass)C++17
27 / 100
89 ms4080 KiB
#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)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:49:30: warning: narrowing conversion of '(*(R + ((sizetype)(((long unsigned int)i) * 2000))))[j]' from 'int' to 'double' [-Wnarrowing]
   49 |             HSV cur = {R[i][j], G[i][j], B[i][j]};
      |                        ~~~~~~^
artclass.cpp:49:39: warning: narrowing conversion of '(*(G + ((sizetype)(((long unsigned int)i) * 2000))))[j]' from 'int' to 'double' [-Wnarrowing]
   49 |             HSV cur = {R[i][j], G[i][j], B[i][j]};
      |                                 ~~~~~~^
artclass.cpp:49:48: warning: narrowing conversion of '(*(B + ((sizetype)(((long unsigned int)i) * 2000))))[j]' from 'int' to 'double' [-Wnarrowing]
   49 |             HSV cur = {R[i][j], G[i][j], B[i][j]};
      |                                          ~~~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...