제출 #59680

#제출 시각아이디문제언어결과실행 시간메모리
59680spencercompton미술 수업 (IOI13_artclass)C++17
43 / 100
151 ms9768 KiB
#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(0); vals.push_back(+c-d-b); vals.push_back(0); } 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; } }; double dif(double x, double y){ return (x-y)/(x+y+0.0001)*2.0 * (x-y) /(x+y+0.0001) *2.0; } class Color{ public: double r, g, b; Color(){ r = 0; g = 0; b = 0; } Color(int x, int y, int z){ r = x; g = y; b = z; } 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 = dif(r,o.r) + dif(g,o.g) + dif(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}; vector<Color> li[H]; double all = 0.0; double tol = 0.05; double per = 0.0; for(int i = 0; i<H; i++){ for(int j = 0; j<W; j++){ li[i].push_back(Color(R[i][j],G[i][j],B[i][j])); if(i>0){ all++; if(li[i][j].cool(li[i-1][j],tol)){ per++; } } if(j>0){ all++; if(li[i][j].cool(li[i][j-1],tol)){ per++; } } sum[0] += R[i][j]; sum[1] += G[i][j]; sum[2] += B[i][j]; } } per /= all; // cout << "!@# " << fixed << setprecision(6) << per << endl; if(per>0.86){ return 4; } if(per>0.60){ return 1; } if(per>0.40){ return 2; } return 3; // 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}; // int best = 1; // for(int i = 0; i<bef.size(); i++){ // tot[bef[i].id] += bef[i].dif(now); // } // for(int i = 2; i<=4; i++){ // if(tot[i]<tot[best]){ // best = i; // } // } // return best; }

컴파일 시 표준 에러 (stderr) 메시지

artclass.cpp: In member function 'double Photo::dif(Photo)':
artclass.cpp:16:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i<vals.size(); i++){
                  ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...