Submission #764009

#TimeUsernameProblemLanguageResultExecution timeMemory
764009ymmArt Class (IOI13_artclass)C++17
67 / 100
64 ms6136 KiB
#include "artclass.h"

#include <bits/stdc++.h>
#define Loop(x, l, r) for (ll x = (l); x < (r); ++x)
typedef long long ll;
typedef std::pair<int,int> pii;
typedef std::pair<ll ,ll > pll;
using namespace std;

int style(int H, int W, int R[500][500], int G[500][500], int B[500][500])
{
	ll sumdif = 0;
	ll cntbig = 0;
	Loop (i,0,H) Loop (j,0,W) {
		for (auto [x, y] : {pii{0, -1}, {0, 1}, {-1, 0}, {1, 0}}) {
			int ii = i+x, jj = j+y;
			if (ii < 0 || H <= ii || jj < 0 || W <= jj)
				continue;
			int dif = 0;
			for (auto X : {R, G, B})
				dif += abs(X[ii][jj] - X[i][j]);
			if (dif >= 32)
				cntbig++;
			else
				sumdif += dif;
		}
	}
	double a = (double)sumdif/(H*W);
	double b = (double)cntbig/(H*W);
	if (a > 35)
		return 2;
	if (b > 2)
		return 3;
	if (b < 0.1)
		return 4;
	return 1;
	//cout << fixed << setprecision(9);
	//cout << a << ' ' << b << '\n';
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...