Submission #56526

#TimeUsernameProblemLanguageResultExecution timeMemory
56526hamzqq9Art Class (IOI13_artclass)C++14
4 / 100
170 ms6652 KiB
#include "artclass.h" #include<bits/stdc++.h> using namespace std; double TYPE[4]={0.000177408580, 0.000013260208}; 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)<=100) return 0; return 1.0*(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/(1.0*total*total); double mnD=1000000000; int whc=-1; for(int i=0;i<2;i++) { if(abs(cur-TYPE[i])<mnD) { mnD=abs(cur-TYPE[i]); whc=i; } } return whc+1; }
#Verdict Execution timeMemoryGrader output
Fetching results...