제출 #885420

#제출 시각아이디문제언어결과실행 시간메모리
885420gustavo_d미술 수업 (IOI13_artclass)C++17
6 / 100
66 ms9196 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) >= 350) return 3; // dividir pelo tamanho da imagem return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...