# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1076031 | TheQuantiX | Art Class (IOI13_artclass) | C++17 | 45 ms | 6060 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "artclass.h"
using namespace std;
vector<float> vecs[4] = {{1.2164, 0.892524, 0.864051, 0.2294985}, {1.17065, 1.15617, 0.669768, 0.346205}, {1.13886, 1.00498, 0.855663, 0.54235}, {1.38868, 1.00333, 0.608068, 0.092916}};
vector<float> vectorize(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
vector<float> ans;
float r = 0, g = 0, b = 0;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if ((R[i][j] + G[i][j] + B[i][j]) == 0) {
continue;
}
r += (float)R[i][j] * 3. / (R[i][j] + G[i][j] + B[i][j]);
g += (float)G[i][j] * 3. / (R[i][j] + G[i][j] + B[i][j]);
b += (float)B[i][j] * 3. / (R[i][j] + G[i][j] + B[i][j]);
}
}
r /= H * W;
g /= H * W;
b /= H * W;
ans.push_back(r);
ans.push_back(g);
ans.push_back(b);
float d = 0;
for (int i = 0; i < H - 1; i++) {
for (int j = 0; j < W; j++) {
// if ((R[i][j] + G[i][j] + B[i][j]) == 0) {
// continue;
// }
d += abs(R[i + 1][j] - R[i][j]) / 255.;
d += abs(G[i + 1][j] - G[i][j]) / 255.;
d += abs(B[i + 1][j] - B[i][j]) / 255.;
}
}
// cout << d << endl;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W - 1; j++) {
// if ((R[i][j] + G[i][j] + B[i][j]) == 0) {
// continue;
// }
d += abs(R[i][j + 1] - R[i][j]) / 255.;
d += abs(G[i][j + 1] - G[i][j]) / 255.;
d += abs(B[i][j + 1] - B[i][j]) / 255.;
}
}
// cout << d << endl;
d /= H * W * 2;
ans.push_back(d);
return ans;
}
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
auto fl = vectorize(H, W, R, G, B);
array<float, 4> diffsq = {0, 0, 0, 0};
for (int i = 0; i < 4; i++) {
for (int j = 0; j < fl.size(); j++) {
diffsq[i] += (fl[j] - vecs[i][j]) * (fl[j] - vecs[i][j]);
}
}
return min_element(diffsq.begin(), diffsq.end()) - diffsq.begin() + 1;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |