제출 #1328575

#제출 시각아이디문제언어결과실행 시간메모리
1328575liwuyouArt Class (IOI13_artclass)C++20
81 / 100
33 ms3344 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]) {
  // black lines
  int cnt = 0;
  for (int i = 10; i + 10 < H; i++) {
    int t = 0, s = 0;
    for (int j = 0; j < W; j++) {
      t += R[i][j] + G[i][j] + B[i][j] <= 60;
      s += R[i][j] + G[i][j] + B[i][j] <= 200;
    }
    if (t >= 0.8 * H) {
      cnt++;
    }
  }
  for (int j = 10; j + 10 < W; j++) {
    int t = 0, s = 0;
    for (int i = 0; i < H; i++) {
      t += R[i][j] + G[i][j] + B[i][j] <= 60;
    }
    if (t >= 0.8 * W) {
      cnt++;
    }
  }
  if (cnt >= 10) {
    return 1;
  }
  // huge blocks
  cnt = 0;
  for (int i = 0; i + 100 < H; i += 50) {
    for (int j = 0; j + 100 < W; j += 50) {
      int r = 0, g = 0, b = 0, t = 0;
      for (int x = 0; x < 100; x++) {
        for (int y = 0; y < 100; y++) {
          r += R[i + x][j + y];
          g += G[i + x][j + y];
          b += B[i + x][j + y];
        }
      }
      r /= 10000, g /= 10000, b /= 10000;
      for (int x = 0; x < 100; x++) {
        for (int y = 0; y < 100; y++) {
          t += abs(R[i + x][j + y] - r) + abs(G[i + x][j + y] - g) + abs(B[i + x][j + y] - b) <= 30;
        }
      }
      if (t >= 95 * 95) {
        cnt++;
        if (r + g + b < 10 || r + g + b > 740) {
          cnt -= 50;
        }
      }
    }
  }
  if (cnt >= 3) {
    return 4;
  }
  // white blocks
  cnt = 0;
  for (int i = 0; i + 50 < H; i += 25) {
    for (int j = 0; j + 50 < W; j += 25) {
      int t = 0;
      for (int x = 0; x < 50; x++) {
        for (int y = 0; y < 50; y++) {
          t += (R[i + x][j + y] >= 0xe0 && G[i + x][j + y] >= 0xe0 && B[i + x][j + y] >= 0xe0);
        }
      }
      if (t >= 45 * 45) {
        cnt++;
      }
    }
  }
  if (cnt >= 3) {
    return 1;
  }
  // green blocks
  cnt = 0;
  for (int i = 0; i + 50 < H; i += 25) {
    for (int j = 0; j + 50 < W; j += 25) {
      int s = 0, t = 0;
      for (int x = 0; x < 50; x++) {
        for (int y = 0; y < 50; y++) {
          s += (G[i + x][j + y] * 1.0 / (R[i + x][j + y] + B[i + x][j + y]) >= 0.55);
        }
      }
      if (s >= 35 * 35) {
        cnt++;
      }
    }
  }
  if (cnt >= 0.3 * H / 25 * W / 25) {
    return 2;
  }
  // not above
  return 3;
}
#Verdict Execution timeMemoryGrader output
Fetching results...