Submission #762177

#TimeUsernameProblemLanguageResultExecution timeMemory
762177SanguineChameleonArt Class (IOI13_artclass)C++17
10 / 100
64 ms9100 KiB
#include "artclass.h"
#include <bits/stdc++.h>
using namespace std;

const int maxN = 5e2 + 20;
int A[maxN][maxN][3];
int dist[3];
int cnt[3];
long double score[3];

int style(int N, int M, int R[500][500], int G[500][500], int B[500][500]) {
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			A[i][j][0] = R[i][j];
			A[i][j][1] = G[i][j];
			A[i][j][2] = B[i][j];
		}
	}
	for (int i = 0; i < 3; i++) {
		cnt[i] = 0;
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			for (int x = 0; x < 3; x++) {
				dist[x] = 0;
				for (int y = 0; y < 3; y++) {
					if (y == x) {
						dist[x] += 255 - A[i][j][y];
					}
					else {
						dist[x] += A[i][j][y];
					}
				}
			}
			int best = 1;
			if (dist[0] < dist[best]) {
				best = 0;
			}
			if (dist[2] < dist[best]) {
				best = 2;
			}
			cnt[best]++;
		}
	}
	if (min({cnt[0], cnt[1], cnt[2]}) <= 200) {
		return 4;
	}
	else if (min({cnt[0], cnt[1], cnt[2]}) >= 10000) {
		return 1;
	}
	else if (cnt[1] >= 20000) {
		return 2;
	}
	else {
		return 3;
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...