Submission #1012618

#TimeUsernameProblemLanguageResultExecution timeMemory
1012618DorostWefArt Class (IOI13_artclass)C++17
Compilation error
0 ms0 KiB
#pragma once

#include <bits/stdc++.h>

using namespace std;

int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
	int white = 0;
	int green = 0;
	int dif = 0;
	int r = 0, g = 0, b = 0;
	int dif2 = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (R[i][j] <= 20 && G[i][j] <= 20 && B[i][j] <= 20) {
				white++;
			}
			if (G[i][j] >= 100 && R[i][j] >= 80 && B[i][j] <= 80) {
				green++;
			}
			r += R[i][j];
			g += G[i][j];
			b += B[i][j];
			if (j != 0) {
				int x = abs(R[i][j] - R[i][j - 1]) + abs(G[i][j] - G[i][j - 1]) + abs(B[i][j] - B[i][j - 1]);
				if (x >= 60) {
					dif ++;
				}
				if (x >= 88)
					dif2++;
			}
			if (i != 0) {
				int x = abs(R[i][j] - R[i - 1][j]) + abs(G[i][j] - G[i - 1][j]) + abs(B[i][j] - B[i - 1][j]);
				if (x >= 60) {
					dif ++;
				}
				if (x >= 88)
					dif2++;
			}
		}
	}
	r /= H;
	g /= H;
	b /= H;
	r /= W;
	g /= W;
	b /= W;
	double wef = (double)dif / (double)(H * W);
	double few = (double)dif2 / (double)(H * W);
	double gg = (double)green / (double)(H * W);
	double ww = (double)white / (double)(H * W);
	//cout << few << ' ' << few + gg << '\n';
//	cout << gg << ' ' << wef << ' ' << few << ' ' << ww << '\n';
	if (wef <= 0.039)
		return 4;
	if (wef >= 0.62)
		return 3;
	if (few / wef >= 0.58)
		return 1;
	return 2;
//	cout << white << ' ' << green << '\n';
//	cout << r << ' ' << g << ' ' << b << '\n';
	if (abs (green - white) <= H * W / 17) {
		return 1;
	}
	if (green > white)
		return 2;
	if (r >= 120)
		return 4;
	return 3;
}

Compilation message (stderr)

artclass.cpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:50:9: warning: unused variable 'gg' [-Wunused-variable]
   50 |  double gg = (double)green / (double)(H * W);
      |         ^~
artclass.cpp:51:9: warning: unused variable 'ww' [-Wunused-variable]
   51 |  double ww = (double)white / (double)(H * W);
      |         ^~
/usr/bin/ld: /tmp/ccZz2OPl.o: in function `main':
grader.c:(.text.startup+0x200): undefined reference to `style'
collect2: error: ld returned 1 exit status