# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
680209 | Dan4Life | Art Class (IOI13_artclass) | C++17 | 83 ms | 4336 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 "artclass.h"
#include <bits/stdc++.h>
using namespace std;
int avg(int a[][500], int x1=0, int y1=0, int x2=500, int y2=500){
int tot = 0;
for(int i = x1; i < x2; i++)
for(int j = y1; j < y2; j++)
tot+=a[i][j];
return tot/((x2-x1+1)*(y2-y1+1));
}
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
int r = avg(R), g = avg(G), b = avg(B);
int rt = avg(R,0,0,500,250), gt = avg(G,0,0,500,250), bt = avg(B,0,0,500,250);
int rb = avg(R,0,250,500,500), gb = avg(G,0,250,500,500), bb = avg(B,0,250,500,500);
int th = 250;
if(g>=th) return 2; //average color is close to green?
if(r>=th and b>=th) return 3; //average color is close to brown? idk
if(rb-rt>=th and gb-gt>=th and bb-bt>=th) return 4; //top half of painting is brighter in comparison to bottom half
if(r<=th and g<=th and b<=th) return 1; // lighter in general
if((r+g+b)/3<=th){ // lightish?
if(rand()%2) return 1;
return 4;
}
if(rand()%2) return 2;
return 3;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |