# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
935119 | anton | Art Class (IOI13_artclass) | C++17 | 63 ms | 6500 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "artclass.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
struct pixel{
pixel(){
}
int r, g, b;
pixel(int a, int _b, int c){
r=a;
g=_b;
b=c;
}
void add(pixel& rh){
r += rh.r;
b+=rh.b;
g+=rh.g;
}
void round_pixel(int rond){
r =(r/rond)*rond;
g =(g/rond)*rond;
b =(b/rond)*rond;
}
string to_s(){
string res;
res.push_back(r);
res.push_back(g);
res.push_back(b);
return res;
}
};
const int comp = 20;
pixel img[500][500];
pixel img2[50][50];
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(40);
img2[i/comp][j/comp].add(img[i][j]);
//cout<<i/comp<<" "<<j/comp<<endl;
m[img[i][j].to_s()]++;
}
}
for(int i = 0; i<H/comp; i++){
for(int j = 0; j<W/comp; j++){
//cout<<i<<" "<<j<<endl;
//cout<<img2[i][j].r<<" "<<img2[i][j].g<<" "<<img2[i][j].b<<endl;
int h_left= min(comp, H-(i*comp));
int w_left= min(comp, W-(j*comp));
img2[i][j].r/=(h_left*w_left);
img2[i][j].g/=(h_left*w_left);
img2[i][j].b/=(h_left*w_left);
//cout<<img2[i][j].r<<" "<<img2[i][j].g<<" "<<img2[i][j].b<<endl;
}
}
vector<int> v;
for(auto e: m){
v.push_back(e.second);
}
sort(v.begin(), v.end());
int mx=0;
for(int i = 0; i<3; i++){
mx+= v[v.size()-1-i];
}
double percentage = (double)(mx)/(double)(H*W);
unordered_map<string, int> m2;
for(int i = 0; i<H/comp; i++){
for(int j = 0; j<W/comp; j++){
img2[i][j].round_pixel(50);
m2[img2[i][j].to_s()]++;
}
}
vector<int> v2;
for(auto e: m2){
v2.push_back(e.second);
}
sort(v2.begin(), v2.end());
int mx2=0;
for(int i = 0; i<1; i++){
mx2+= v2[v2.size()-1-i];
}
double percentage2 = (double)(mx2)/(double)((H/comp)*(W/comp));
//cout<<v.size()<<endl;
//cout<<percentage<<" "<<percentage2<<endl;
if(percentage>0.5){
if(percentage2 >0.4){
return 4;
}
else{
return 1;
}
}
else{
if(percentage2 >0.4){
return 3;
}
else{
return 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;*/
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |