Submission #57396

#TimeUsernameProblemLanguageResultExecution timeMemory
57396joaogui1Art Class (IOI13_artclass)C++14
9 / 100
142 ms3612 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; int dist(int a, int b, int c, int x, int y, int z){ double d = abs(a - x) + abs(b - y) + abs(c - z); return d; } double mean(int R[500][500], int G[500][500], int B[500][500], int x, int y){ double ret = 0; int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1}; for(int i = 0; i < 4; ++i) ret += dist(R[x][y], G[x][y], B[x][y], R[x + dx[i]][y + dy[i]], G[x + dx[i]][y + dy[i]], B[x + dx[i]][y + dy[i]]); return ret; } int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { double d = 0; for(int i = 1; i < H; ++i) for(int j = 1; j < W; ++j){ d += mean(R, G, B, i, j); } d /= H*W; //cout << d << "\n"; //cout << d << " "; if(d < 37) return 4; if(90.0 > d) return 1; if(200.0 > d) return 2; else return 3; //return d; }
#Verdict Execution timeMemoryGrader output
Fetching results...