제출 #1149685

#제출 시각아이디문제언어결과실행 시간메모리
1149685epicci23미술 수업 (IOI13_artclass)C++20
5 / 100
32 ms3352 KiB
#include "bits/stdc++.h"
#include "artclass.h"
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;

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;		
  	}
  }
  
  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 timeMemoryGrader output
Fetching results...