Submission #764013

#TimeUsernameProblemLanguageResultExecution timeMemory
764013ymmArt Class (IOI13_artclass)C++17
84 / 100
58 ms3336 KiB
#include "artclass.h" #include <bits/stdc++.h> #define Loop(x, l, r) for (ll x = (l); x < (r); ++x) typedef long long ll; typedef std::pair<int,int> pii; typedef std::pair<ll ,ll > pll; using namespace std; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { ll sumdif = 0; ll cntbig = 0; Loop (i,0,H) Loop (j,0,W) { for (auto [x, y] : {pii{0, -1}, {0, 1}, {-1, 0}, {1, 0}}) { int ii = i+x, jj = j+y; if (ii < 0 || H <= ii || jj < 0 || W <= jj) continue; int dif = 0; for (auto X : {R, G, B}) dif += abs(X[ii][jj] - X[i][j]); if (dif >= 32) cntbig++; else sumdif += dif; } } double a = (double)sumdif/(H*W); double b = (double)cntbig/(H*W); if (b < 0.1) return 4; if (b < 1) return 1; if (b < 2) return 2; return 3; cout << fixed << setprecision(9); cout << a << ' ' << b << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...