제출 #369328

#제출 시각아이디문제언어결과실행 시간메모리
369328kostia244미술 수업 (IOI13_artclass)C++17
49 / 100
103 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 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] = {max(1,R[i][j]),max(1,G[i][j]),max(1,B[i][j])}; } ld f = sharpness(); 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:32:20: warning: narrowing conversion of '(int)std::max<int>(1, (*(R + ((sizetype)(((long unsigned int)i) * 2000))))[j])' from 'int' to 'long double' [-Wnarrowing]
   32 |    img[i][j] = {max(1,R[i][j]),max(1,G[i][j]),max(1,B[i][j])};
      |                 ~~~^~~~~~~~~~~
artclass.cpp:32:35: warning: narrowing conversion of '(int)std::max<int>(1, (*(G + ((sizetype)(((long unsigned int)i) * 2000))))[j])' from 'int' to 'long double' [-Wnarrowing]
   32 |    img[i][j] = {max(1,R[i][j]),max(1,G[i][j]),max(1,B[i][j])};
      |                                ~~~^~~~~~~~~~~
artclass.cpp:32:50: warning: narrowing conversion of '(int)std::max<int>(1, (*(B + ((sizetype)(((long unsigned int)i) * 2000))))[j])' from 'int' to 'long double' [-Wnarrowing]
   32 |    img[i][j] = {max(1,R[i][j]),max(1,G[i][j]),max(1,B[i][j])};
      |                                               ~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...