# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
969232 | anango | Art Class (IOI13_artclass) | C++17 | 56 ms | 3924 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;
bool bounds(int x, int y) {
return (0<=x && x<500 && 0<=y && y<500);
}
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
double bl=0;
int T[500][500];
vector<int> dx={0,0,-1,1};
vector<int> dy={1,-1,0,0};
for (int i=0; i<500; i++) {
for (int j=0; j<500; j++) {
T[i][j] = (R[i][j]+G[i][j]+B[i][j])/3;
}
}
for (int i=0; i<500; i++) {
for (int j=0; j<500; j++) {
for (int d=0; d<4; d++) {
int nx=i+dx[d];
int ny=j+dy[d];
if (!bounds(nx,ny)) {
continue;
}
bl+=abs(R[nx][ny]-R[i][j]);
bl+=abs(G[nx][ny]-G[i][j]);
bl+=abs(B[nx][ny]-B[i][j]);
}
}
}
bl = bl/500/500;
//cout << bl << endl;
if (bl<38) {
return 4;
}
if (bl<79) {
return 1;
}
if (bl<193) {
return 2;
}
return 3;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |