# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
532233 | TheWilp | Art Class (IOI13_artclass) | C++14 | 78 ms | 14120 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;
};
bool macth(const std::vector<std::vector<std::vector<int>>>& p1, int i1, int j1, int i2, int j2) {
return (p1[0][i1][j1] == p1[0][i2][j2]) && (p1[1][i1][j1] == p1[1][i2][j2]) && (p1[2][i1][j1] == p1[2][i2][j2]);
}
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 = 1;
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.2)
style2++;
}
}
// else
std::vector<std::vector<std::vector<int>>> s1(3, std::vector<std::vector<int>>(500, std::vector<int>(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);
}
}
std::vector<std::vector<int>> s(500, std::vector<int>(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 && macth(s1,x,y,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 && macth(s1, x, y, x + 1, y)) {
v.push_back(name(x + 1, y));
s[x + 1][y] = 1;
}
}
if (y != 0){
if (s[x][y - 1] == 0 && macth(s1, x, y, x, y - 1)) {
v.push_back(name(x, y - 1));
s[x][y - 1] = 1;
}
}
if (y != W - 1) {
if (s[x][y + 1] == 0 && macth(s1, x, y, x, y + 1)) {
v.push_back(name(x, y + 1));
s[x][y + 1] = 1;
}
}
++i;
}
if (s[q][w] == 0) {
v.push_back(name(q,w));
++block;
}
}
}
// std::cout << style2 << " " << block << std::endl;;
if (style2 >= 60 * H * W / 100)
return 2;
if (block <= 6)
return 4;
if (block <= 100)
return 1;
else return 4;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |