Submission #379885

#TimeUsernameProblemLanguageResultExecution timeMemory
379885WLZArt Class (IOI13_artclass)C++14
80 / 100
75 ms6124 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; const vector<int> dx = {1, -1, 0, 0}; const vector<int> dy = {0, 0, 1, -1}; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { double val = 0.0; int cnt = 0; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { for (int k = 0; k < 4; k++) { int ni = i + dx[k], nj = j + dy[k]; if (ni < 0 || nj < 0 || ni >= H || nj < 0) continue; val += abs(R[i][j] - R[ni][nj]) + abs(G[i][j] - G[ni][nj]) + abs(G[i][j] - G[ni][nj]); cnt += 3; } } } if (val / cnt < 3.0) return 4; if (val / cnt < 6.0) return 1; if (val / cnt < 15.0) return 2; return 3; }
#Verdict Execution timeMemoryGrader output
Fetching results...