# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
962178 | n3rm1n | Art Class (IOI13_artclass) | C++17 | 88 ms | 8532 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<bits/stdc++.h>
#include "artclass.h"
using namespace std;
int r[505][505];
int g[505][505];
int b[505][505];
int n, m;
/// ednakvi -> 1
/// podobni <= 5 -> 2
/// razlichni -> 3
int eval(int h1, int w1, int h2, int w2)
{
if(h1 < 0 || h1 > n)return 0;
if(h2 < 0 || h2 > n)return 0;
if(w1 < 0 || w1 > m)return 0;
if(w2 < 0 || w2 > m)return 0;
int distR = abs(r[h1][w1] - r[h2][w2]);
int distG = abs(g[h1][w1] - g[h2][w2]);
int distB = abs(b[h1][w1] - b[h2][w2]);
if(distR == 0 && distB == 0 && distG == 0)return 1;
if(distR <= 10 && distB <= 10 && distG <= 10)return 2;
return 3;
}
int style(int H,int W, int R[500][500],int G[500][500],int B[500][500])
{
n = H;
m = W;
for (int i = 0; i < H; ++ i)
{
for (int j = 0; j < W; ++ j)
{
r[i][j] = R[i][j];
b[i][j] = B[i][j];
g[i][j] = G[i][j];
}
}
int same = 0, close = 0, diff = 0;
int all = 0;
for (int i = 0; i < H; ++ i)
{
for (int j = 0; j < W; ++ j)
{
int type = eval(i, j, i-1, j);
if(type == 1)
same ++;
else if(type == 2)
close ++;
else if(type == 3)
diff ++;
type = eval(i, j, i+1, j);
if(type == 1)
same ++;
else if(type == 2)
close ++;
else if(type == 3)
diff ++;
type = eval(i, j, i, j-1);
if(type == 1)
same ++;
else if(type == 2)
close ++;
else if(type == 3)
diff ++;
type = eval(i, j, i, j+1);
if(type == 1)
same ++;
else if(type == 2)
close ++;
else if(type == 3)
diff ++;
type = eval(i, j, i-1, j-1);
if(type == 1)
same ++;
else if(type == 2)
close ++;
else if(type == 3)
diff ++;
type = eval(i, j, i-1, j+1);
if(type == 1)
same ++;
else if(type == 2)
close ++;
else if(type == 3)
diff ++;
type = eval(i, j, i+1, j-1);
if(type == 1)
same ++;
else if(type == 2)
close ++;
else if(type == 3)
diff ++;
type = eval(i, j, i+1, j+1);
if(type == 1)
same ++;
else if(type == 2)
close ++;
else if(type == 3)
diff ++;
}
}
all = same + close + diff;
if(same >= all/100*80)return 1;
if(diff >= all/100*80)return 4;
if(close >= all/100*80)return 2;
return 3;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |