Submission #729374

# Submission time Handle Problem Language Result Execution time Memory
729374 2023-04-24T01:57:31 Z kevlu8 Art Class (IOI13_artclass) C++17
Compilation error
0 ms 0 KB
#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;
}

Compilation message

/usr/bin/ld: /tmp/ccHVOsCm.o: in function `main':
artclass.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccp8ffuj.o:grader.c:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccp8ffuj.o: in function `main':
grader.c:(.text.startup+0x200): undefined reference to `style'
collect2: error: ld returned 1 exit status