Submission #557149

#TimeUsernameProblemLanguageResultExecution timeMemory
557149emuyumiArt Class (IOI13_artclass)C++17
80 / 100
63 ms6032 KiB
#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)

artclass.cpp: In function 'int adj_diff(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:35:17: warning: unused variable 'cur' [-Wunused-variable]
   35 |             int cur = abs(R[i][j] - lr) + abs(G[i][j] - lg) + abs(B[i][j] - lb);
      |                 ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...