제출 #597381

#제출 시각아이디문제언어결과실행 시간메모리
597381skittles1412미술 수업 (IOI13_artclass)C++17
69 / 100
54 ms5984 KiB
#include "bits/extc++.h" using namespace std; template <typename T> void dbgh(const T& t) { cerr << t << endl; } template <typename T, typename... U> void dbgh(const T& t, const U&... u) { cerr << t << " | "; dbgh(u...); } #ifdef DEBUG #define dbg(...) \ cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \ dbgh(__VA_ARGS__); #else #define dbg(...) #define cerr \ if (false) \ cerr #endif #define endl "\n" #define long int64_t #define sz(x) int((x).size()) extern "C" int style(int n, int m, int r[500][500], int g[500][500], int b[500][500]) { cerr << fixed << setprecision(5); auto eq = [&](int a, int b, int x) -> bool { return abs(a - b) <= x; }; auto req = [&](int x1, int y1, int x2, int y2, int x) -> bool { return eq(r[x1][y1], r[x2][y2], x) && eq(g[x1][y1], g[x2][y2], x) && eq(b[x1][y1], b[x2][y2], x); }; { auto f1 = [&](int x) -> int { int ans = 0; for (int i = 0; i < n - 1; i++) { for (int j = 0; j < m - 1; j++) { ans += req(i, j, i, j + 1, x) + req(i + 1, j, i, j, x); } } return ans; }; int x2 = 0, x3 = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { int csum = r[i][j] + b[i][j] + g[i][j]; x2 += csum >= 700; x3 += csum <= 50; } } double d1 = double(f1(10)) / (2 * n * m), d2 = double(x2) / (n * m), d3 = double(f1(20)) / (n * m), d4 = double(f1(20)) / (2 * n * m); cerr << d1 << " " << d2 << " " << d3 << endl; if (d1 > 0.9) { if (d2 > 0.05) { return 1; } else { return 4; } } else if (d1 > 0.5 && d2 > 0.05) { return 1; } else if (d1 > 0.5 || d2 < 1e-3) { return 2; } else { return 3; } } }

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

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:63:47: warning: unused variable 'd4' [-Wunused-variable]
   63 |                d3 = double(f1(20)) / (n * m), d4 = double(f1(20)) / (2 * n * m);
      |                                               ^~
#Verdict Execution timeMemoryGrader output
Fetching results...