# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
56519 | hamzqq9 | Art Class (IOI13_artclass) | C++14 | 136 ms | 6652 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |