제출 #125742

#제출 시각아이디문제언어결과실행 시간메모리
125742MoNsTeR_CuBe미술 수업 (IOI13_artclass)C++17
100 / 100
179 ms6136 KiB
#include <bits/stdc++.h>
#include "artclass.h"
using namespace std;

int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
    double r = 0, g = 0, b = 0;
    
    double totG = 0;
    double totR = 0;
    double totB = 0;
    
    for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			totG += G[i][j];
			totR += R[i][j];
			totB += B[i][j];
			
			if(j + 1 < W){
				r += abs(R[i][j] - R[i][j+1]);
				g += abs(G[i][j] - G[i][j+1]);
				b += abs(B[i][j] - B[i][j+1]);
			}
			if(i + 1 < H){
				r += abs(R[i][j] - R[i+1][j]);
				g += abs(G[i][j] - G[i+1][j]);
				b += abs(B[i][j] - B[i+1][j]);
			}
		}
	}
	//cout << r/((double)(H*W)) << ' ' << g/((double)(H*W)) << ' ' << b/((double)(H*W)) << endl;
	
	if(r/((double)(H*W)) < (double)(6.22) || g/((double)(H*W)) < (double)(6) || b/((double)(H*W)) < (double)(6.1)){
		return 4;
	}
	
	if(r/((double)(H*W)) > (double)(36.8) || g/((double)(H*W)) > (double)(36.3) || b/((double)(H*W)) > (double)(35.3)){
		return 3;
	}
	
	if(totR/((double)(H*W)) > (double)(130.0) && totG/((double)(H*W)) > (double)(130.0) && totB/((double)(H*W) > (double)(130.0))){
		return 1;
	}
	return 2;
	//cout << totR/((double)(H*W)) << ' ' << totG/((double)(H*W)) << ' ' << totB/((double)(H*W)) << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...