제출 #1328574

#제출 시각아이디문제언어결과실행 시간메모리
1328574liwuyou미술 수업 (IOI13_artclass)C++20
70 / 100
38 ms3340 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 < 490; i++) {
    int t = 0, s = 0;
    for (int j = 0; j < 500; j++) {
      t += R[i][j] + G[i][j] + B[i][j] <= 60;
      s += R[i][j] + G[i][j] + B[i][j] > 0;
    }
    if (t >= 400 && s) {
      cnt++;
    }
  }
  for (int j = 10; j < 490; j++) {
    int t = 0, s = 0;
    for (int i = 0; i < 500; i++) {
      t += R[i][j] + G[i][j] + B[i][j] <= 60;
      s += R[i][j] + G[i][j] + B[i][j] > 0;
    }
    if (t >= 400 && s) {
      cnt++;
    }
  }
  if (cnt >= 10) {
    return 1;
  }
  // huge blocks
  cnt = 0;
  for (int i = 0; i < 400; i += 50) {
    for (int j = 0; j < 400; 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 && r + g + b >= 4) {
        cnt++;
      }
      if (r + g + b >= 700) {
        cnt -= 100;
      }
    }
  }
  if (cnt >= 3) {
    return 4;
  }
  // white blocks
  cnt = 0;
  for (int i = 0; i < 450; i += 25) {
    for (int j = 0; j < 450; 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 < 450; i += 25) {
    for (int j = 0; j < 450; 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 >= 80) {
    return 2;
  }
  // not above
  return 3;
}
#Verdict Execution timeMemoryGrader output
Fetching results...