# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
491801 | Lawliet | Art Class (IOI13_artclass) | C++17 | 64 ms | 6340 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 "artclass.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 510;
struct Pixel
{
int r, g, b;
Pixel(int red = 0, int green = 0, int blue = 0)
: r(red), b(blue), g(green) {}
int operator - (Pixel a)
{
int diff = abs(r - a.r);
diff += abs(b - a.b);
diff += abs(g - a.g);
return diff;
}
};
int n, m;
Pixel v[MAXN][MAXN];
int is1or4()
{
int qtdBad = 0;
int c = 50;
for(int i = 1 ; i <= n ; i++)
{
for(int j = 1 ; j <= m ; j++)
{
bool isBad = false;
for(int x = max(i - 1,0) ; x<= i + 1 && x <= n ; x++)
for(int y = max(j - 1,0) ; y <= j + 1 && y <= m ; y++)
if( v[i][j] - v[x][y] > 50 ) isBad = true;
if( isBad )
qtdBad++;
}
}
return qtdBad;
}
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500])
{
n = H; m = W;
for(int i = 1 ; i <= n ; i++)
for(int j = 1 ; j <= m ; j++)
v[i][j] = Pixel(R[i - 1][j - 1], G[i - 1][j - 1], B[i - 1][j - 1]);
if( is1or4() <= (n*m)/3 )
{
if( is1or4() <= 10000 )
return 4;
return 1;
}
int sumGreen = 0, sumRed = 0, sumBlue = 0;
for(int i = 1 ; i <= n ; i++)
for(int j = 1 ; j <= m ; j++)
sumGreen += v[i][j].g, sumRed += v[i][j].r, sumBlue += v[i][j].b;
sumGreen /= n*m;
sumRed /= n*m;
sumBlue /= n*m;
// printf("r = %d g = %d b = %d %d\n",sumRed,sumGreen,sumBlue,sumRed + sumBlue + sumGreen);
if( sumBlue + sumGreen + sumRed >= 300 && sumBlue >= 80 )
return 3;
return 2;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |