제출 #868708

#제출 시각아이디문제언어결과실행 시간메모리
868708anachor미술 수업 (IOI13_artclass)C++14
0 / 100
54 ms3524 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++; } } ans += dd/cc; } } ans /= K*K; return ans; }; double dd = var(1); if (dd < 6) return 4; return 0; if (dd < 18) return 1; if (dd < 27) return 2; return 3; }

컴파일 시 표준 에러 (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...