제출 #434898

#제출 시각아이디문제언어결과실행 시간메모리
434898QCFium미술 수업 (IOI13_artclass)C++14
100 / 100
105 ms3308 KiB
#include <bits/stdc++.h> #include "artclass.h" int ri() { int n; scanf("%d", &n); return n; } int value1(int h, int w, int r[500][500], int g[500][500], int b[500][500]) { auto diff = [&] (int i0, int j0, int i1, int j1) { return std::abs(r[i0][j0] - r[i1][j1]) + std::abs(g[i0][j0] - g[i1][j1]) + std::abs(b[i0][j0] - b[i1][j1]); }; int r0 = 0; for (int i = 0; i + 1 < h; i++) { for (int j = 0; j < w; j++) { int cur_diff = diff(i, j, i + 1, j); if (cur_diff > 40) r0 += cur_diff; } } int r1 = 0; for (int i = 0; i < h; i++) { for (int j = 0; j + 1 < w; j++) { int cur_diff = diff(i, j, i, j + 1); if (cur_diff > 40) r1 += cur_diff; } } int r2 = 0; for (int i = 0; i + 1 < h; i++) { for (int j = 0; j + 1 < w; j++) { int cur_diff = diff(i, j, i + 1, j + 1); if (cur_diff > 40) r2 += cur_diff; } } return std::min({r0, r1, r2}) * 10 / h / w; } int value3(int h, int w, int r[500][500], int g[500][500], int b[500][500]) { auto diff = [&] (int i0, int j0, int i1, int j1) { return std::abs(r[i0][j0] - r[i1][j1]) + std::abs(g[i0][j0] - g[i1][j1]) + std::abs(b[i0][j0] - b[i1][j1]); }; const int THRESHOLD = 50; int r0 = 0; for (int i = 0; i + 1 < h; i++) { for (int j = 0; j < w; j++) { int cur_diff = diff(i, j, i + 1, j); if (cur_diff < THRESHOLD) r0 += cur_diff; } } return r0 * 10 / h / w; } int style(int h, int w, int r[500][500], int g[500][500], int b[500][500]) { int r1 = value1(h, w, r, g, b); int r3 = value3(h, w, r, g, b); if (r1 <= 15) return 4; if (r1 >= 400) return 3; if (r3 <= 125) return 1; else return 2; }

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

artclass.cpp: In function 'int ri()':
artclass.cpp:6:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...