# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
411234 | faresbasbs | Art Class (IOI13_artclass) | C++14 | 121 ms | 9204 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>
#include "artclass.h"
using namespace std;
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
long long sum = 0 , diff = 0 , sum1 = 0 , sum2 = 0 , sum3 = 0 , mx = 0 , mn = 100000000 , p = 0 , p2 = 0;
long long med1 , med2 , med3;
vector<long long> all1,all2,all3;
for(int i = 0 ; i < H ; i += 1){
for(int j = 0 ; j < W ; j += 1){
long long f = R[i][j]+G[i][j]+B[i][j];
mn = min(mn,f);
mx = max(mx,f);
sum1 += R[i][j];
sum2 += G[i][j];
sum3 += B[i][j];
all1.push_back(R[i][j]),all2.push_back(G[i][j]),all3.push_back(B[i][j]);
if(f >= 600){
p += 1;
}
if(f <= 100){
p2 += 1;
}
}
}
sort(all1.begin(),all1.end()),sort(all2.begin(),all2.end()),sort(all3.begin(),all3.end());
med1 = all1[all1.size()/2] , med2 = all2[all2.size()/2] , med3 = all3[all3.size()/2];
long long mdv = max({med1,med2,med3})-min({med1,med2,med3});
for(int i = 0 ; i < H ; i += 1){
for(int j = 0 ; j < W ; j += 1){
long long f = R[i][j]+G[i][j]+B[i][j];
mn = min(mn,f);
mx = max(mx,f);
if(f >= mx-100){
p += 1;
}
if(f <= mn+100){
p2 += 1;
}
}
}
sum = sum1+sum2+sum3 , diff = max({sum1,sum2,sum3})-min({sum1,sum2,sum3});
// cout << sum1 << " " << sum2 << " " << sum3 << endl;
// cout << " - " << (sum+diff)/2 << endl;
// cout << mn << " " << mx << " " << p << " " << p2 << endl;
int cnt[5];
memset(cnt,0,sizeof cnt);
if(sum >= 100000000){
cnt[1] += 1;
}
if(sum2 >= 40000000){
cnt[1] += 1;
}
if(sum1 >= 40000000){
cnt[1] += 1;
}
if(med3 < 190){
cnt[2] += 1 , cnt[3] += 1 , cnt[4] += 1;
}
if(p >= 150000){
cnt[1] += 1;
}
if(mx-mn <= 600){
cnt[4] += 1;
}
if(mn >= 40){
cnt[4] += 1;
}
if(diff >= 5000000 && diff <= 15000000){
cnt[2] += 1;
}
if(diff <= 5000000){
cnt[3] += 1;
}
long long maxi = max({cnt[1],cnt[2],cnt[3],cnt[4]});
// cout << maxi << " " << cnt[4] << endl;
for(int i = 4 ; i >= 1 ; i -= 1){
if(cnt[i] == maxi){
return i;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |