Submission #885497

#TimeUsernameProblemLanguageResultExecution timeMemory
885497gustavo_dArt Class (IOI13_artclass)C++17
8 / 100
62 ms6484 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; struct Pixel { int r, g, b; Pixel() { r=-1, g=-1; b=-1; } Pixel(int red, int green, int blue) { r = red; g = green; b = blue; } }; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { Pixel img[H][W]; for (int i=0; i<H; i++) { for (int j=0; j<W; j++) { img[i][j] = Pixel(R[i][j], G[i][j], B[i][j]); } } ll total_dist = 0; for (int i=1; i<H-1; i++) { for (int j=1; j<W-1; j++) { vector<int> dif(3); dif = {-1, 0, 1}; for (int di : dif) { for (int dj : dif) { total_dist += abs(img[i][j].r - img[i+di][j+dj].r); total_dist += abs(img[i][j].g - img[i+di][j+dj].g); total_dist += abs(img[i][j].b - img[i+di][j+dj].b); } } } } //cout << total_dist/((ll)H*(ll)W) << endl; if (total_dist/((ll)H * (ll)W) >= 400) return 3; // dividir pelo tamanho da imagem return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...