Submission #1074183

#TimeUsernameProblemLanguageResultExecution timeMemory
1074183IgnutArt Class (IOI13_artclass)C++17
96 / 100
70 ms6228 KiB
// Ignut #include <bits/stdc++.h> #include "artclass.h" using namespace std; using ll = long long; using ld = long double; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { ld avgDiff = 0; int cntE = 0; for (int i = 0; i < H; i ++) { for (int j = 0; j < W - 1; j ++) { cntE ++; avgDiff += (R[i][j] - R[i][j + 1]) * (R[i][j] - R[i][j + 1]); avgDiff += (G[i][j] - G[i][j + 1]) * (G[i][j] - G[i][j + 1]); avgDiff += (B[i][j] - B[i][j + 1]) * (B[i][j] - B[i][j + 1]); } } for (int i = 0; i < H - 1; i ++) { for (int j = 0; j < W; j ++) { cntE ++; avgDiff += (G[i][j] - G[i + 1][j]) * (G[i][j] - G[i + 1][j]); avgDiff += (B[i][j] - B[i + 1][j]) * (B[i][j] - B[i + 1][j]); avgDiff += (R[i][j] - R[i + 1][j]) * (R[i][j] - R[i + 1][j]); } } int avgD = int(avgDiff / cntE); int avgG = 0; for (int i = 0; i < H; i ++) { for (int j = 0; j < W; j ++) { avgG += 2 * G[i][j] - R[i][j] - B[i][j]; } } avgG /= H * W; if (avgD <= 150) return 4; if (avgD >= 2000) return 3; if (avgG >= 20) return 2; return 1; // return int(avgDiff / cntE); }
#Verdict Execution timeMemoryGrader output
Fetching results...