제출 #1328627

#제출 시각아이디문제언어결과실행 시간메모리
1328627liwuyou미술 수업 (IOI13_artclass)C++20
100 / 100
46 ms3336 KiB
#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]) {
  int block = 0, line = 0, Size = 8;
  for (int i = 0; i + Size < H; i += Size) {
    for (int j = 0; j + Size < W; j += Size) {
      int r = 0, g = 0, b = 0;
      for (int x = 0; x < Size; x++) {
        for (int y = 0; y < Size; y++) {
          r += R[i + x][j + y];
          g += G[i + x][j + y];
          b += B[i + x][j + y];
        }
      }
      r /= Size * Size, g /= Size * Size, b /= Size * Size;
      int sum = 0;
      for (int x = 0; x < Size; x++) {
        for (int y = 0; y < Size; y++) {
          sum += abs(r - R[i + x][j + y]) + abs(g - G[i + x][j + y]) + abs(b - B[i + x][j + y]);
        }
      }
      sum /= Size * Size;
      block += sum <= 10;
      line += sum >= 100;
    }
  }
  double linep = 1.0 * line * Size * Size / H / W, blockp = 1.0 * block * Size * Size / H / W;
  return blockp > 0.25 ? linep < 0.033 ? 4 : 1 : linep < 0.1 ? 2 : 3;
}
#Verdict Execution timeMemoryGrader output
Fetching results...