Submission #868706

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8687062023-11-01 16:10:32anachorArt Class (IOI13_artclass)C++14
62 / 100
52 ms6228 KiB
#include "artclass.h"
#include<bits/stdc++.h>
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
using namespace std;
const int K = 500;
int d = 1;
auto exists = [&](int x, int y) {
return 0 <= x && x < K && 0 <= y && y < K;
};
auto diff = [&](int x, int y, int X, int Y) {
return (abs(R[x][y] - R[X][Y])) + (abs(G[X][Y] - G[x][y])) + (abs(G[X][Y] - G[x][y]))/3.0;
};
auto var = [&] (int d) {
double ans = 0;
for (int i=0; i<K; i++) {
for (int j=0; j<K; j++) {
double dd = 0;
int cc = 0;
for (int dx=-d; dx<=d; dx++) {
for (int dy=-d; dy<=d; dy++) {
int nx = i+dx, ny = j+dy;
if (!exists(nx, ny)) continue;
dd += diff(i, j, nx, ny);
cc++;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:8:9: warning: unused variable 'd' [-Wunused-variable]
    8 |     int d = 1;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...