# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
59654 | spencercompton | 미술 수업 (IOI13_artclass) | C++17 | 125 ms | 3624 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "artclass.h"
#include <bits/stdc++.h>
using namespace std;
class Photo{
public:
vector<double> vals;
int id;
Photo(double b, double c, double d, int a){
id = a;
vals.push_back(b);
vals.push_back(c);
vals.push_back(d);
}
double dif(Photo o){
double ret = 0.0;
for(int i = 0; i<vals.size(); i++){
// cout << "# " << vals[i] << " " << o.vals[i] << endl;
ret += (vals[i]-o.vals[i]) * (vals[i]-o.vals[i]);
}
return ret;
}
};
class Color{
public:
double r, g, b;
Color(){
r = 0;
g = 0;
b = 0;
}
Color(int x, int y, int z){
double tot = x+y+z;
r = x;
r/= tot;
g = y;
g/= tot;
b = z;
b /= tot;
}
bool operator<(const Color &o) const{
if(r!=o.r){
return r<o.r;
}
if(g!=o.g){
return g<o.g;
}
return b<o.b;
}
bool cool(Color o, double tol){
double val = (r-o.r)*(r-o.r) + (g-o.g) * (g-o.g) + (b-o.b) * (b-o.b);
// cout << "@ " << val << " " << tol << endl;
return val<=tol;
}
};
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
double sum[3] = {0.0,0.0,0.0};
for(int i = 0; i<H; i++){
for(int j = 0; j<W; j++){
sum[0] += R[i][j];
sum[1] += G[i][j];
sum[2] += B[i][j];
}
}
for(int i = 0; i<3; i++){
sum[i] /= H*W;
}
// cout << "bef.push_back(Photo(" << sum[0] << ", " << sum[1] << ", " << sum[2] << ", ";
Photo now = Photo(sum[0],sum[1],sum[2],-1);
vector<Photo> bef;
bef.push_back(Photo(190.324, 175.007, 159.743, 1));
bef.push_back(Photo(147.793, 137.624, 94.7409, 1));
bef.push_back(Photo(188.825, 159.937, 143.64, 1));
bef.push_back(Photo(173.11, 148.423, 130.601, 1));
bef.push_back(Photo(209.025, 199.682, 197.314, 1));
bef.push_back(Photo(229.496, 210.578, 141.905, 1));
bef.push_back(Photo(180.467, 174.2, 178.657, 1));
bef.push_back(Photo(169.395, 161.816, 156.893, 1));
bef.push_back(Photo(220.232, 133.557, 122.695, 1));
bef.push_back(Photo(130.771, 116.231, 86.0482, 2));
bef.push_back(Photo(116.816, 108.483, 68.9826, 2));
bef.push_back(Photo(122.273, 86.3923, 46.4901, 2));
bef.push_back(Photo(76.5431, 86.4914, 59.5179, 2));
bef.push_back(Photo(82.5524, 77.3391, 45.9116, 2));
bef.push_back(Photo(111.459, 110.026, 65.8072, 2));
bef.push_back(Photo(126.313, 103.38, 76.9841, 2));
bef.push_back(Photo(98.2613, 103.548, 58.0462, 2));
bef.push_back(Photo(60.6975, 91.1116, 70.2834, 2));
bef.push_back(Photo(142.305, 134.207, 119.739, 3));
bef.push_back(Photo(139.022, 118.038, 85.0787, 3));
bef.push_back(Photo(143.453, 139.216, 133.429, 3));
bef.push_back(Photo(124.075, 116.275, 102.134, 3));
bef.push_back(Photo(131.676, 105.793, 65.2298, 3));
bef.push_back(Photo(216.569, 201.339, 156.971, 3));
bef.push_back(Photo(114.869, 112.627, 83.4856, 3));
bef.push_back(Photo(119.47, 113.515, 98.8594, 3));
bef.push_back(Photo(133.837, 115.121, 118.349, 3));
bef.push_back(Photo(100.719, 110.242, 119.565, 4));
bef.push_back(Photo(84.5105, 23.8112, 25.2976, 4));
bef.push_back(Photo(217.14, 6.45131, 14.198, 4));
bef.push_back(Photo(239.767, 156.768, 89.0347, 4));
bef.push_back(Photo(155.385, 76.7555, 39.738, 4));
bef.push_back(Photo(195.063, 118.751, 25.1931, 4));
bef.push_back(Photo(46.4144, 48.1066, 50.294, 4));
bef.push_back(Photo(182.285, 104.388, 75.9469, 4));
bef.push_back(Photo(201.687, 162.679, 58.5665, 4));
double tot[5] = {0.0,0.0,0.0,0.0,0.0};
for(int i = 0; i<bef.size(); i++){
tot[bef[i].id] += bef[i].dif(now);
}
int best = 1;
for(int i = 2; i<=4; i++){
if(tot[i]<tot[best]){
best = i;
}
}
return best;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |