Submission #1149690

#TimeUsernameProblemLanguageResultExecution timeMemory
1149690epicci23Art Class (IOI13_artclass)C++20
5 / 100
33 ms3340 KiB
#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] += R[i][j];
  	  tot[1] += G[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] >= R[i][j]+B[i][j]) g++;
  	  if(R[i][j] >= G[i][j]+B[i][j]) r++;
  	  if(B[i][j] >= 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;		
  	}
  }
  
  //if(sb >= H*W/2) return 1;
  if(tot[1] - (tot[0]+tot[2])/2 >= 10) return 2;
  if(kac <= 5) return 4;
  return 3;
}
#Verdict Execution timeMemoryGrader output
Fetching results...