# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
962152 | Ice_man | Art Class (IOI13_artclass) | C++14 | 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.
/**
____ ____ ____ __________________ ____ ____ ____
||I || ||c || ||e || || || ||M || ||a || ||n ||
||__|| ||__|| ||__|| ||________________|| ||__|| ||__|| ||__||
|/__\| |/__\| |/__\| |/________________\| |/__\| |/__\| |/__\|
*/
#include <iostream>
#include <chrono>
#include <vector>
#include <algorithm>
#include <cstdio>
#define maxn 2000005
#define maxlog 20
#define INF 1000000010
#define LINF 1000000000000000005
#define endl '\n'
#define pb(x) push_back(x)
#define X first
#define Y second
#define control cerr<<"passed"<<endl;
#pragma GCC optimize("O3" , "Ofast" , "unroll-loops" , "fast-math")
#pragma GCC target("avx2")
using namespace std;
/**std::chrono::high_resolution_clock::time_point startT, currT;
constexpr double TIME_MULT = 1;
double timePassed()
{
using namespace std::chrono;
currT = high_resolution_clock::now();
double time = duration_cast<duration<double>>(currT - startT).count();
return time * TIME_MULT;
}*/
int r[500][500], g[500][500], b[500][500];
int br = 0;
int sum(int i1, int j1, int i2, int j2)
{
br++;
int _r = abs(r[i1][j1] - r[i2][j2]);
int _g = abs(g[i1][j1] - g[i2][j2]);
int _b = abs(b[i1][j1] - b[i2][j2]);
return _r + _g + _b;
}
int h, w;
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++)
{
r[i][j] = R[i][j];
g[i][j] = G[i][j];
b[i][j] = B[i][j];
}
/**cin >> h >> w;
for(int i = 0; i < h; i++)
for(int j = 0; j < w; j++)
{
cin >> r[i][j];
cin >> g[i][j];
cin >> b[i][j];
}*/
long long res = 0; // 191250000
for(int i = 0; i < h; i++)
for(int j = 0; j < w; j++)
{
if(i >= 1)
res += sum(i, j, i - 1, j);
if(j >= 1)
res += sum(i, j, i, j - 1);
if(i >= 1 && j >= 1)
res += sum(i, j, i - 1, j - 1);
}
res /= br;
///cout << res << endl;
if(res <= 9)
return 4;
if(res <= 26)
return 1;
if(res <= 59)
return 2;
return 3;
}
/**int main()
{
#ifdef ONLINE_JUDGE /// promeni
freopen("input.in", "r", stdin);
///freopen("taxi.out", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
//startT = std::chrono::high_resolution_clock::now();
style();
return 0;
}*/