제출 #369333

#제출 시각아이디문제언어결과실행 시간메모리
369333kostia244미술 수업 (IOI13_artclass)C++17
62 / 100
110 ms17900 KiB
#include "artclass.h" #include<bits/stdc++.h> using namespace std; using ld = long double; const int maxn = 500; using vec = array<ld, 3>; const vec green = {0, 255, 0}; const vec white = {255, 255, 255}; ld dif(vec a, vec b) { ld t = 0; for(int i = 0; i < 3; i++) t += (a[i]-b[i])*(a[i]-b[i]); return sqrt(t); } int n, m; vec img[maxn][maxn]; ld compare(vec col) { ld sum = 0; for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) sum += dif(img[i][j], col); return sum / (n*m); } ld sharpness() { ld sum = 0; for(int i = 0; i+1 < n; i++) for(int j = 0; j < m; j++) sum += dif(img[i][j], img[i+1][j]); for(int i = 0; i < n; i++) for(int j = 0; j+1 < m; j++) sum += dif(img[i][j], img[i][j+1]); sum /= n*(m-1) + (n-1)*m; return sum; } int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { n = H, m = W; for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) { img[i][j] = {R[i][j],G[i][j],B[i][j]}; } ld f = sharpness(); ld g = compare(white); if(g < 200.) return 1; if(f > 30.) return 3; if(f < 5.) return 4; return 2; }

컴파일 시 표준 에러 (stderr) 메시지

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:39:23: warning: narrowing conversion of '(*(R + ((sizetype)(((long unsigned int)i) * 2000))))[j]' from 'int' to 'long double' [-Wnarrowing]
   39 |    img[i][j] = {R[i][j],G[i][j],B[i][j]};
      |                 ~~~~~~^
artclass.cpp:39:31: warning: narrowing conversion of '(*(G + ((sizetype)(((long unsigned int)i) * 2000))))[j]' from 'int' to 'long double' [-Wnarrowing]
   39 |    img[i][j] = {R[i][j],G[i][j],B[i][j]};
      |                         ~~~~~~^
artclass.cpp:39:39: warning: narrowing conversion of '(*(B + ((sizetype)(((long unsigned int)i) * 2000))))[j]' from 'int' to 'long double' [-Wnarrowing]
   39 |    img[i][j] = {R[i][j],G[i][j],B[i][j]};
      |                                 ~~~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...