# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
201193 | gratus907 | Art Class (IOI13_artclass) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(x) ((x).begin()),((x).end())
using pii = pair <int, int>;
#define colordist(x1,y1,x2,y2) (abs(R[x1][y1]-R[x2][y2])+abs(G[x1][y1]-G[x2][y2])+abs(B[x1][y1]-B[x2][y2]))
int R[505][505],B[505][505],G[505][505];
int style(int H, int W)
{
double avg_color_dist = 0;
for (int i = 1; i<H; i++)
{
for (int j = 1; j<W; j++)
{
double a = colordist(i,j,i-1,j);
double b = colordist(i,j,i,j-1);
avg_color_dist += (a+b);
}
}
avg_color_dist /= (H*W);
if(avg_color_dist < 18) return 4;
if(avg_color_dist < 47) return 1;
if(avg_color_dist > 107) return 3;
return 2;
}
int main()
{
int h, w;
cin >> h >> w;
for (int i = 0; i<h; i++)
{
for (int j = 0; j<w; j++)
{
cin >> R[i][j];
}
}
for (int i = 0; i<h; i++)
{
for (int j = 0; j<w; j++)
{
cin >> G[i][j];
}
}
for (int i = 0; i<h; i++)
{
for (int j = 0; j<w; j++)
{
cin >> B[i][j];
}
}
cout << style(h,w);
}