Submission #586852

#TimeUsernameProblemLanguageResultExecution timeMemory
586852benjaminkleynArt Class (IOI13_artclass)C++17
21 / 100
93 ms3332 KiB
#include "artclass.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int style(int h, int w, int r[500][500], int g[500][500], int b[500][500])
{
    ll sumz = 0;
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
            if (g[i][j] > r[i][j] + b[i][j])
                sumz += g[i][j];

    if (sumz > h * w * 100)
        return 2;

    ll total_offset = 0;
    for (int i = 2; i < h - 2; i++)
        for (int j = 2; j < w - 2; j++)
        {
            ll sumR = 0, sumG = 0, sumB = 0;
            for (int k = i - 2; k <= i + 2; k++)
                for (int l = j - 2; l <= j + 2; l++)
                    sumR += r[k][l], sumG += g[k][l], sumB += b[k][l];
            ll offset = 0;
            for (int k = i - 2; k <= i + 2; k++)
                for (int l = j - 2; l <= j + 2; l++)
                {
                    offset += abs(sumR - 25 * r[k][l]);
                    offset += abs(sumG - 25 * g[k][l]);
                    offset += abs(sumB - 25 * b[k][l]);
                }
            total_offset += offset / 25;
        }

    if (total_offset > 350000000)
        return 3;

    ll cnt_black = 0;
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
            if (r[i][j] + g[i][j] + b[i][j] < 60)
                cnt_black++;

    if (cnt_black * 20 > h * w)
        return 1;

    return 4;
}
#Verdict Execution timeMemoryGrader output
Fetching results...