Submission #597358

#TimeUsernameProblemLanguageResultExecution timeMemory
597358skittles1412Art Class (IOI13_artclass)C++17
65 / 100
56 ms6036 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]) { { auto f1 = [&](int x) -> int { auto eq = [&](int a, int b) -> bool { return abs(a - b) <= x; }; auto req = [&](int x1, int y1, int x2, int y2) -> bool { return eq(r[x1][y1], r[x2][y2]) && eq(g[x1][y1], g[x2][y2]) && eq(b[x1][y1], b[x2][y2]); }; 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) + req(i + 1, j, i, j); } } return ans; }; int x2 = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { x2 += r[i][j] + b[i][j] + g[i][j] >= 700; } } double d1 = double(f1(10)) / (2 * n * m), d2 = double(x2) / (n * m); cerr << d1 << " " << d2 << 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 (d2 > 1e-4) { return 3; } else { return 2; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...