Submission #367194

#TimeUsernameProblemLanguageResultExecution timeMemory
367194idk321Art Class (IOI13_artclass)C++11
6 / 100
166 ms13548 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; int style(int h, int w, int r[500][500], int g[500][500], int b[500][500]) { vector<int> differences; map<array<int, 3>, int> freq; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { /* for (int k = -1; k <= 1; k++) { for (int l = -1; l <= 1; l++) { int i2 = i + k; int j2 = j + l; if (i2 == i && j2 == j) continue; if (i2 >= 0 && i2 < h && j2 >= 0 && j2 < w) { int diff = abs(r[i2][j2] - r[i][j]); diff += abs(g[i2][j2] - g[i][j]); diff += abs(b[i2][j2] - b[i][j]); diff *= diff; differences.push_back(diff); } } } */ freq[{r[i][j], g[i][j], b[i][j]}]++; } } int diff = 0; double sum = 0; for (auto it = freq.begin(); it != freq.end(); it++) { sum += it->second * it->second; diff++; } if (sum / diff > 1000) { return 1; } else return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...