# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
739668 | yeyso | Art Class (IOI13_artclass) | C++14 | 59 ms | 9100 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 style(int h, int w, int R[500][500], int G[500][500], int B[500][500]) {
//return 2;
vector<vector<int>> gr(h, vector<int>(w, 0));
vector<vector<int>> gg(h, vector<int>(w, 0));
vector<vector<int>> gb(h, vector<int>(w, 0));
vector<int> grd(500, 0);
vector<int> grg(500, 0);
vector<int> grb(500, 0);
int mcir = 0;
int mcig = 0;
int mcib = 0;
int noiser = 0;
int noiseg = 0;
int noiseb = 0;
int productrgb = 1;
int dr, dg, db;
int white = 0;
for(int i = 1; i < h; i ++){
for(int j = 1; j < w; j ++){
dr = 2 * R[i][j] - R[i-1][j] - R[i][j-1];
dg = 2 * G[i][j] - G[i-1][j] - G[i][j-1];
db = 2 * B[i][j] - B[i-1][j] - B[i][j-1];
if(R[i][j] > 200 and G[i][j] > 200 and B[i][j] > 200){
white += 1;
}
gr[i][j] = dr;
gg[i][j] = dg;
gb[i][j] = db;
grd[abs(dr)] += 1;
grg[abs(dg)] += 1;
grb[abs(db)] += 1;
noiser += abs(dr);
noiseg += abs(dg);
noiseb += abs(db);
}
}
noiser /= (h * w);
noiseg /= (h * w);
noiseb /= (h * w);
vector<int> rfix = {0};
vector<int> gfix = {0};
vector<int> bfix = {0};
for(int i = 0; i < grd.size(); i ++){
rfix.push_back(rfix[rfix.size()-1] + grd[i]);
gfix.push_back(gfix[gfix.size()-1] + grg[i]);
bfix.push_back(rfix[bfix.size()-1] + grb[i]);
}
//for(int i = 0; i < rfix.size(); i ++){
//cout << grd[i] << " ";
//}
//cout << rfix[6] + gfix[6] + bfix[6];
//cout << white;
if(rfix[6] + gfix[6] + bfix[6] > 200000){
// it's either style 1 (modern) or style 4 (landscape)
if(white > 20000){
return 1;
} else {
return 4;
}
} else {
// it's either style 2 (impressionist) or style 3 (modern 2)
if(rfix[6] + gfix[6] + bfix[6] > 50000){
return 2;
} else {
return 3;
}
}
//return productrgb;
/*for(int i = 0; i < grd.size(); i ++){
if(grd[i] > grd[mcir]){
mcir = i;
}
if(grg[i] > grg[mcig]){
mcig = i;
}
if(grb[i] > grb[mcib]){
mcib = i;
}
}
if(mcir + mcig + mcib <= 3){
// it's either style 1 or 4
if(noiser + noiseg + noiseb < 17){
return 4;
} else {
return 1;
}
} else {
if(noiser + noiseg + noiseb > 100){
return 3;
} else {
return 2;
}
}*/
//return mcir + mcig + mcib;
//return max(1, min(4, mcir + mcig + mcib +1 ));
//return noiser + noiseg + noiseb;
}
/*
g++ -DEVAL -static -O2 -o artclass grader.c artclass.cpp
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |