#include "bits/stdc++.h"
#include "artclass.h"
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]){
array<int,3> tot = {0,0,0};
int last = -1, kac = 0, sb = 0;
for(int i=0;i<H;i++){
int r=0,g=0,b=0;
for(int j=0;j<W;j++){
tot[0] += G[i][j];
tot[1] += R[i][j];
tot[2] += B[i][j];
if(max({G[i][j],R[i][j],B[i][j]}) - min({G[i][j],R[i][j],B[i][j]}) <= 10) sb++;
if(G[i][j] >= max(R[i][j],B[i][j])) g++;
if(R[i][j] >= max(G[i][j],B[i][j])) r++;
if(B[i][j] >= max(R[i][j],G[i][j])) b++;
}
if(g >= 2*(r+b)){
kac += (last != 0);
last = 0;
}
else if(r >= 2*(g+b)){
kac += (last != 1);
last = 1;
}
else if(b >= 2*(r+g)){
kac += (last != 2);
last = 2;
}
else{
kac += (last != 3);
last = 3;
}
}
return 1 + (rng() % 4);
if(sb >= H*W/2) return 1;
if(tot[0] >= 2*(tot[1] + tot[2])) return 2;
if(kac <= 5) return 4;
return 3;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |