# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
557149 | emuyumi | Art Class (IOI13_artclass) | C++17 | 63 ms | 6032 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;
using ll = long long;
int count_white(int H, int W, int R[500][500], int G[500][500], int B[500][500]){
int cnt = 0;
for (int i = 0; i < H; ++i){
for (int j = 0; j < W; ++j){
if (255 * 3 - R[i][j] - G[i][j] - B[i][j] <= 150){
cnt++;
}
}
}
return cnt;
}
int count_black(int H, int W, int R[500][500], int G[500][500], int B[500][500]){
int cnt = 0;
for (int i = 0; i < H; ++i){
for (int j = 0; j < W; ++j){
if (R[i][j] + G[i][j] + B[i][j] <= 50){
cnt++;
}
}
}
return cnt;
}
int adj_diff(int H, int W, int R[500][500], int G[500][500], int B[500][500]){
int ret = 0;
int lr = 0, lg = 0, lb = 0;
for (int i = 0; i < H; ++i){
for (int j = 0; j < W; ++j){
int cur = abs(R[i][j] - lr) + abs(G[i][j] - lg) + abs(B[i][j] - lb);
ret += abs(R[i][j] - lr);
ret += abs(G[i][j] - lg);
ret += abs(B[i][j] - lb);
lr = R[i][j], lg = G[i][j], lb = B[i][j];
}
}
return ret;
}
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
int diff = adj_diff(H, W, R, G, B);
int white = count_white(H, W, R, G, B);
if (diff <= 2e6) return 4;
if (diff >= 9e6) return 3;
if (white >= 5e3) return 1;
return 2;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |