| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 140265 | cfalas | Art Class (IOI13_artclass) | C++14 | 233 ms | 11484 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#include "artclass.h"
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
#define F first
#define S second
int style(int h, int w, int r[500][500], int g[500][500], int b[500][500]) {
double tot = 0;
double totr=0, totg=0, totb=0;
set<iii> colors;
set<iii> allcolors;
int dr=0, dg=0, db=0;
int light = 0, dark = 0;
map<iii, int> colfreq;
for(int i=3;i<h;i++){
for(int j=0;j<w;j++){
tot+=r[i][j]+g[i][j]+b[i][j];
totr+=r[i][j];
totg+=g[i][j];
totb+=b[i][j];
colors.insert(iii(r[i][j]/64, ii(g[i][j]/64, b[i][j]/64)));
allcolors.insert(iii(r[i][j], ii(g[i][j], b[i][j])));
colfreq[iii(r[i][j]/16, ii(g[i][j]/16, b[i][j]/16))]++;
if(r[i][j]>g[i][j] && r[i][j]>b[i][j]) dr++;
if(g[i][j]>b[i][j] && g[i][j]>r[i][j]) dg++;
if(b[i][j]>r[i][j] && b[i][j]>g[i][j]) db++;
if(r[i][j] + g[i][j] + b[i][j] < 50) dark++;
else if(r[i][j] + g[i][j] + b[i][j] > 300) light++;
}
}
vector<pair<int, iii> > v;
for(map<iii,int>::iterator it = colfreq.begin();it!=colfreq.end();it++){
v.push_back(make_pair((*it).S, (*it).F));
}
sort(v.begin(), v.end());
double totcommoncolors = 0;
for(int i=v.size()-1;i>=v.size()-10;i--){
totcommoncolors+=v[i].F;
}
if(colors.size()<=20 || dr>(dg+db)*30) return 4;
if(dr+dg>db*8 && totr+totg > 3*totb) return 2;
if(totcommoncolors/(w*h)>0.5) return 1;
if(dark+light*2 > w*h && allcolors.size()>30000 && colors.size()>20) return 3;
//if(totg > totb && totb<totr) return 2;
return 1;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
