# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
962178 | n3rm1n | 미술 수업 (IOI13_artclass) | C++17 | 88 ms | 8532 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |