# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1014156 | ZanP | Art Class (IOI13_artclass) | C++17 | 39 ms | 6224 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 <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#define ll long long
using namespace std;
struct color {
ll r = 0, g = 0, b = 0;
color(){}
};
ll w, h;
vector<vector<color>> image;
ifstream imgfile;
vector<color> averages;
void print_color(color c) {
cout << "{ r:" << c.r << " , g:" << c.g << " , b:" << c.b << " }";
}
color avg_color() {
color avg;
for (int i = 0; i < h; i++)for (int j = 0; j < w; j++) {
avg.r += image[i][j].r;
avg.g += image[i][j].g;
avg.b += image[i][j].b;
}
avg.r /= (w * h);
avg.g /= (w * h);
avg.b /= (w * h);
return avg;
}
int style(int H,int W, int R[500][500],int G[500][500],int B[500][500])
{
image.resize(h, vector<color>(w));
for (int i = 0; i < h; i++)for (int j = 0; j < w; j++) {
image[i][j].r = R[i][j];
image[i][j].g = G[i][j];
image[i][j].b = B[i][j]; }
color avg = avg_color();
ll sum = avg.r + avg.b + avg.g;
if(sum < 300){return 2;}
if(sum < 350){return 4;}
if(sum < 450){return 3;}
return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |