# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
729374 | kevlu8 | Art Class (IOI13_artclass) | C++17 | 0 ms | 0 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 <iostream>
using namespace std;
int t, n, m;
#define getR(x) ((x >> 16) & 0xFF)
#define getG(x) ((x >> 8) & 0xFF)
#define getB(x) (x & 0xFF)
#define green getG(x)
#define red getR(x)
#define blue getB(x)
inline bool iswhite(int x) {
return red > 140 && blue > 140 && green > 140 && abs(red - green) < 40 && abs(red - blue) < 40 && abs(blue - green) < 40;
}
inline bool isgreen(int x) {
return green > 32 && green > blue+40 && green > red-8 && !iswhite(x);
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> t;
while (t--) {
cin >> n >> m;
int numzeros=0, grncnt=0, whitecnt=0, prev=0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
int x;
cin >> x;
whitecnt += iswhite(x);
grncnt += isgreen(x);
if ((getR(prev) - red + getG(prev) - green + getB(prev) - blue) < 8) numzeros++;
prev = x;
}
}
#ifdef PRINT_DBG
cout << m*n << ' ' << grncnt << ' ' << whitecnt << ' ' << numzeros << ' ';
#endif
if (numzeros < n*m*0.7) {
if (grncnt > n*m/10) cout << "2\n";
else cout << "3\n";
} else {
if (whitecnt > n*m/4) cout << "1\n";
else cout << "4\n";
}
}
return 0;
}