Submission #61328

#TimeUsernameProblemLanguageResultExecution timeMemory
61328dukati8Art Class (IOI13_artclass)C++14
16 / 100
143 ms3692 KiB
#include <stdio.h>
#include "artclass.h"
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define rep(i,a,b) for(int i=a;i<int(b);i++)

int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
  //Check sum of all pixels
  double totr,totb,totg;
  totr=0;totb=0;totg=0;
  rep (i,0,H) {
    rep (j,0,W) {
      totr+=R[i][j];
      totb+=B[i][j];
      totg+=G[i][j];
    }
  }

  totr/=H*W;
  totb/=H*W;
  totg/=H*W;

  double hi=max(totr,max(totg,totb));
  double lo=min(totr,min(totg,totb));
  double med=totr+totg+totb-hi-lo;
  double diff1=hi-med;
  double diff2=med-lo;
  //cout << totr << " " << totg << " " << totb<<endl;
  if (lo*2.5<hi) return 4;
  if (1.3*totb<totg && 1.5*totb<totr && totg+totr+totb<350) return 2;
  if (lo*1.3>hi) return 3;
  if (abs(diff1-diff2)<0.7*min(diff1,diff2)) return 3;

  if (totg+totr+totb<500) return 1;
  //Check for 10*10 square that is relatively white
  return 1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...