#include "artclass.h"
#include<bits/stdc++.h>
using namespace std;
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
float res = 0;
int e = 1;
for (int i=0; i<H; i++){
for (int j=0; j<W-1; j++) res += pow(abs(R[i][j]-R[i][j+1]), e)+pow(abs(G[i][j]-G[i][j+1]), e)+pow(abs(B[i][j]-B[i][j+1]), e);
}
for (int i=0; i<H-1; i++){
for (int j=0; j<W; j++) res += pow(abs(R[i][j]-R[i+1][j]), e)+pow(abs(G[i][j]-G[i+1][j]), e)+pow(abs(B[i+1][j]-B[i][j]), e);
}
float x = 2*(H-1)*(W-1)+H+W-2;
res /= x;
if (res < 9) return 4;
if (res < 23) return 1;
if (res < 55) return 2;
return 3;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |