Submission #15767

#TimeUsernameProblemLanguageResultExecution timeMemory
15767aintaArt Class (IOI13_artclass)C++98
71 / 100
139 ms6516 KiB
#include "artclass.h" #include<stdio.h> #include<algorithm> #define bound 30 #define bound2 0.66 using namespace std; int r[501][501], g[501][501], b[501][501]; int Diff(int x,int y,int x2, int y2){ return abs(r[x][y]-r[x2][y2]) + abs(g[x][y]-g[x2][y2]) + abs(b[x][y]-b[x2][y2]); } int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { int i, j, tot1 = 0, tot2 = 0, val1 = 0, val2 = 0; for(i=0;i<H;i++){ for(j=0;j<W;j++){ r[i][j] = R[i][j], g[i][j] = G[i][j], b[i][j] = B[i][j]; } } for(i=0;i<H;i++){ for(j=0;j<W;j++){ if(i+1 < H){ tot1++; if(Diff(i,j,i+1,j) < bound)val1++; } if(j+1 < W){ tot2++; if(Diff(i,j,i,j+1) < bound)val2++; } } } double t = (double)(val1+val2)/(tot1+tot2); if(t > bound2){ double t1 = (double)(tot1 - val1)/tot1, t2 = (double)(tot2 - val2)/tot2; if(t1/t2 < 0.86 || t2/t1 < 0.86)return 4; return 1; } else{ if(t < 0.45)return 3; else return 2; } }
#Verdict Execution timeMemoryGrader output
Fetching results...