# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
285868 | AMO5 | Art Class (IOI13_artclass) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "artclass.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define sz(x) int(x.size())
#define maxn 505
using ii = pair<int,int>;
/* style 1, cc
* style 4, cc (blur)
* style 2, mostly green
* style 3, complicated
*/
int h,w;
int c[mxn][mxn][3];
int dif(int x, int y, int x2, int y2){
int sum = 0;
for(int k:{0,1,2}){
sum+=abs(c[x][y][k]-c[x2][y2][k]);
}
return sum;
}
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]){
h=H,w=W;
for(int i=0; i<h; i++){
for(int j=0; j<w; j++){
c[i][j][0]=R[i][j];
c[i][j][1]=G[i][j];
c[i][j][2]=B[i][j];
}
}
int sum=0,cnt=0;
for(int i=0; i<h; i++){
for(int j=0; j<w; j++){
if(i)sum+=dif(i,j,i-1,j),cnt++;
if(j)sum+=dif(i,j,i,j-1),cnt++;
if(i+1<h)sum+=dif(i,j,i+1,j),cnt++;
if(j+1<w)sum+=dif(i,j,i,j+1),cnt++;
}
}
sum/=cnt;
if(sum>=55)return 3;
if(sum>=25)return 2;
if(sum>=10)return 1;
return 4;
}
/*
int main() {
return 0;
}
// */