제출 #250973

#제출 시각아이디문제언어결과실행 시간메모리
250973A02미술 수업 (IOI13_artclass)C++14
0 / 100
110 ms8300 KiB
#include "artclass.h" #include <iostream> #include <vector> #include <math.h> #include <stdlib.h> using namespace std; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { vector<long long> differences; for (int i = 2; i < H - 2; i++){ for (int j = 2; j < W - 2; j++){ long long difference = 0; for (int dx = -2; dx <= 2; dx++){ for (int dy = -2; dy <= 2; dy++){ difference += abs(R[i + dx][j + dy] - R[i][j]); difference += abs(B[i + dx][j + dy] - B[i][j]); difference += abs(G[i + dx][j + dy] - G[i][j]); } } differences.push_back(difference); } } long long total = 0; for (int i = 0; i < differences.size(); i++){ total += differences[i] * differences[i]; } double avgd = sqrt(((double) total) / ((double)((H-2) * (W-2)))); cout << avgd; if (avgd < 700){ return 4; } if (avgd > 2000){ return 3; } long long intensity = 0; for (int i = 0; i < H; i++){ for (int j = 0; j < W; j++){ intensity += (R[i][j] + G[i][j] + B[i][j]) * ((R[i][j] + G[i][j] + B[i][j])); } } double ag = sqrt(intensity / (H * W)); if (intensity > 400){ return 1; } return 2; }

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

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:30:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < differences.size(); i++){
                     ~~^~~~~~~~~~~~~~~~~~~~
artclass.cpp:52:12: warning: unused variable 'ag' [-Wunused-variable]
     double ag = sqrt(intensity / (H * W));
            ^~
#Verdict Execution timeMemoryGrader output
Fetching results...