제출 #56670

#제출 시각아이디문제언어결과실행 시간메모리
56670hamzqq9미술 수업 (IOI13_artclass)C++14
100 / 100
131 ms3708 KiB
#include "artclass.h"

#include<bits/stdc++.h>
using namespace std;

int way[2][2]={-1,0,0,-1};

int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
	
	double tot=0;
	int total=0;

	for(int i=0;i<H;i++) {

		for(int j=0;j<W;j++) {

			for(int w=0;w<2;w++) {

				int toi=i+way[w][0];
				int toj=j+way[w][1];

				if(toi<0 || toj<0 || toi==H || toj==W) continue ;

				tot+=abs(R[toi][toj]-R[i][j]);
				tot+=abs(G[toi][toj]-G[i][j]);
				tot+=abs(B[toi][toj]-B[i][j]);

				total++;

			}

		}

	}

	double res=tot/total;

	if(res>=56) return 3;
	if(res>=24) return 2;
	if(res>=9) return 1;
	return 4;

}
#Verdict Execution timeMemoryGrader output
Fetching results...