제출 #935111

#제출 시각아이디문제언어결과실행 시간메모리
935111anton미술 수업 (IOI13_artclass)C++17
9 / 100
69 ms8020 KiB
#include "artclass.h" #include<bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int, int> const int rond = 20; struct pixel{ pixel(){ } int r, g, b; pixel(int a, int _b, int c){ r=a; g=_b; b=c; } void round_pixel(){ r =(r/rond)*rond; g =(r/rond)*rond; b =(r/rond)*rond; } string to_s(){ string res; res.push_back(r); res.push_back(g); res.push_back(b); return res; } }; pixel img[500][500]; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { unordered_map<string, int> m; for(int i = 0; i<H; i++){ for(int j = 0; j<W; j++){ img[i][j] = pixel(R[i][j], G[i][j], B[i][j]); img[i][j].round_pixel(); m[img[i][j].to_s()]++; } } vector<int> v; for(auto e: m){ v.push_back(e.second); } sort(v.begin(), v.end()); //cout<<v.size()<<endl; int mx=0; for(int i = 0; i<3; i++){ mx+= v[v.size()-1-i]; } double percentage = (double)(mx)/(double)(H*W); //cout<<percentage<<endl; if(percentage>0.5){ return (rand()%2)*3 + 1; } else{ return (rand()%2)+2; } /*ll s= 0.; for(int j = 0; j<W; j++){ for(int i = 0; i<H-1; i++){ s+=(R[j][i+1]-R[j][i])*(R[j][i+1]-R[j][i]) + (G[j][i+1]-G[j][i])*(G[j][i+1]-G[j][i]) + (B[j][i+1]-B[j][i])*(B[j][i+1]-B[j][i]); } } double avg = (double)(s)/((double)((H-1)*W)); cout<<avg<<endl;*/ return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...