/**
____ ____ ____ __________________ ____ ____ ____
||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 < n; i++)
for(int j = 0; j < m; 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;
}*/
Compilation message
artclass.cpp: In function 'int style()':
artclass.cpp:61:9: error: 'H' was not declared in this scope
61 | h = H;
| ^
artclass.cpp:62:9: error: 'W' was not declared in this scope
62 | w = W;
| ^
artclass.cpp:64:24: error: 'n' was not declared in this scope
64 | for(int i = 0; i < n; i++)
| ^
artclass.cpp:65:28: error: 'm' was not declared in this scope
65 | for(int j = 0; j < m; j++)
| ^
artclass.cpp:67:23: error: 'R' was not declared in this scope
67 | r[i][j] = R[i][j];
| ^
artclass.cpp:68:23: error: 'G' was not declared in this scope
68 | g[i][j] = G[i][j];
| ^
artclass.cpp:69:23: error: 'B' was not declared in this scope
69 | b[i][j] = B[i][j];
| ^