# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1075574 | TheQuantiX | 미술 수업 (IOI13_artclass) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
vector<float> vecs[4] = {{0.707344, 0.363771, 0.543803}, {0.994021, 0.989584, 0.00129563}, {1.02652, 0.767299, 0.00728856}, {0.995276, 0.500576, 0.0165025}};
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++) {
r += R[i][j] * 3 / (R[i][j] + G[i][j] + B[i][j]);
g += G[i][j] * 3 / (R[i][j] + G[i][j] + B[i][j]);
b += 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);
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;
}