제출 #56519

#제출 시각아이디문제언어결과실행 시간메모리
56519hamzqq9미술 수업 (IOI13_artclass)C++14
56 / 100
136 ms6652 KiB
#include "artclass.h"
 
#include<bits/stdc++.h>
using namespace std;
 
double TYPE[4]={27609.340823508253,5590.306744599146,128276.092630415398,473.938244162467};
 
int R[505][505],G[505][505],B[505][505];
 
double TotD;
int total;
 
int w[4][2]={1,0,0,1,-1,0,0,-1};
 
double sq(int a,int b) {
 
	if(abs(a-b)<=50) return 0;
 
	return abs(1.0*(a-b)*(a-b)*(a-b));
 
}
 
double get(int x,int y,int a,int b) {
 
	double DR=sq(R[x][y],R[a][b]);
	double DG=sq(G[x][y],G[a][b]);
	double DB=sq(B[x][y],B[a][b]);
 
	return (DR+DG+DB)/3.0;
 
}
 
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
 
	for(int i=0;i<H;i++) {
 
		for(int j=0;j<W;j++) {
 
			::R[i][j]=R[i][j];
			::G[i][j]=G[i][j];
			::B[i][j]=B[i][j];
 
		}
 
	}
    
	for(int i=0;i<H;i++) {
 
		for(int j=0;j<W;j++) {
 
			for(int way=0;way<4;way++) {
 
				int tor=i+w[way][0];
				int toc=j+w[way][1];
 
				if(tor>=0 && tor<H && toc>=0 && toc<W) {
 
					total++;
 
					TotD+=get(i,j,tor,toc);
 
				}
 
			}
 
		}
 
	}
 
	double cur=1.0*TotD/total;
 
	double mnD=1000000000;
	int whc=-1;
 
	for(int i=0;i<4;i++) {
 
		if(abs(cur-TYPE[i])<mnD) {
 
			mnD=abs(cur-TYPE[i]);
			whc=i;
 
		}
 
	}
 
	return whc+1;
 
}
#Verdict Execution timeMemoryGrader output
Fetching results...