제출 #251194

#제출 시각아이디문제언어결과실행 시간메모리
251194AaronNaidu미술 수업 (IOI13_artclass)C++14
60 / 100
82 ms3508 KiB
#include <bits/stdc++.h>
#include "artclass.h"
using namespace std;
typedef long long ll;

int R[500][500], B[500][500], G[500][500];

int style(int h, int w, int r[500][500], int g[500][500], int b[500][500]) {
    ll totGreen = 0;
    ll totRed = 0;
    ll totBlue = 0;
    ll numWhite = 0;
    ll numBlack = 0;
    ll difference = 0;
    for (int i = 0; i < 500; i++)
    {
        for (int j = 0; j < 500; j++)
        {
            totGreen += g[i][j];
            totBlue += b[i][j];
            totRed += r[i][j];  
            if (r[i][j] < 50 and b[i][j] < 50 and g[i][j] < 50)
            {
                numWhite++;
            }
            if (r[i][j] > 220 and b[i][j] > 220 and g[i][j] > 220)
            {
                numBlack++;
            }
            if (i > 0 and j > 0 and i < 499 and j < 499)
            {
                difference += abs(r[i][j] - r[i-1][j]) + abs(r[i][j] - r[i+1][j]) + abs(r[i][j] - r[i][j+1]) + abs(r[i][j] - r[i][j-1]);
                difference += abs(g[i][j] - g[i-1][j]) + abs(g[i][j] - g[i+1][j]) + abs(g[i][j] - g[i][j+1]) + abs(g[i][j] - g[i][j-1]);
                difference += abs(b[i][j] - b[i-1][j]) + abs(b[i][j] - b[i+1][j]) + abs(b[i][j] - b[i][j+1]) + abs(b[i][j] - b[i][j-1]);
            }
            
        }
    }
    if (numBlack > 30000)
    {
        return 1;
    }
    if (difference/1000 < 10000)
    {
        return 4;
    }
    if (max(totRed/1000, max(totGreen/1000, totBlue/1000)) - min(totRed/1000, min(totGreen/1000, totBlue/1000)) < 5000)
    {
        return 3;
    }
    
    return 2;
    
    cout << totGreen/1000 << " " << totRed/1000 << " " << totBlue/1000 << "\n";
    cout << numWhite << " " << numBlack << "\n";;
    cout << difference/1000;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...