# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
532204 | TheWilp | Art Class (IOI13_artclass) | C++14 | 69 ms | 9264 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "artclass.h"
#include <iostream>
#include <vector>
class name {
public:
name(int a, int b) {
x = a;
y = b;
}
int x;
int y;
};
int Ge(int a,int g) {
a /= g;
return a;
}
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
double style1 = 0;
double style2 = 0;
double style3 = 0;
double style4 = 0;
// style2
int s2[3];
const int generalize1 = 2;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
s2[0] = Ge(R[i][j], generalize1);
s2[1] = Ge(G[i][j], generalize1);
s2[2] = Ge(B[i][j], generalize1);
if (s2[1] > s2[2] * 1.3);
style2++;
}
}
// else
int s1[3][500][500];
const int generalize2 = 64;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
s1[0][i][j] = Ge(R[i][j], generalize2);
s1[1][i][j] = Ge(G[i][j], generalize2);
s1[2][i][j] = Ge(B[i][j], generalize2);
}
}
int s[500][500];
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
s[i][j] = 0;
}
}
int block = 0;
std::vector<name> v;
int i = 0;
for (int q = 0; q < H; q++) {
for (int w = 0; w < W; w++) {
while (i != v.size()) {
int x = v[i].x;
int y = v[i].y;
if (x != 0) {
if (s[x - 1][y] == 0 && s1[x][y] == s1[x - 1][y]) {
v.push_back(name(x - 1, y));
s[x - 1][y] = 1;
}
}
if (x != H - 1) {
if (s[x + 1][y] == 0 && s1[x][y] == s1[x + 1][y]) {
v.push_back(name(x + 1, y));
s[x + 1][y];
}
}
if (y != 0){
if (s[x][y - 1] == 0 && s1[x][y] == s1[x][y - 1]) {
v.push_back(name(x, y - 1));
s[x][y - 1];
}
}
if (y != W - 1) {
if (s[x][y + 1] == 0 && s1[x][y] == s1[x][y + 1]) {
v.push_back(name(x, y + 1));
s[x][y + 1];
}
}
++i;
}
if (s[q][w] == 0) {
v.push_back(name(q,w));
++block;
}
}
}
if (style2 >= 60 * H * W / 100)
return 2;
if (block <= 6)
return 4;
if (block <= 100)
return 1;
else return 4;
return 1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |