제출 #679853

#제출 시각아이디문제언어결과실행 시간메모리
679853bashkortArt Class (IOI13_artclass)C++17
1 / 100
211 ms6220 KiB
#include "artclass.h"
#include <bits/stdc++.h>

using namespace std;

int n, m, R[500][500], G[500][500], B[500][500];

int dist(int i, int j, int x, int y) {
    return abs(R[i][j] - R[x][y]) + abs(B[i][j] - B[x][y]) + abs(G[i][j] - G[x][y]);
}

bool black(int i, int j) {
    return R[i][j] + B[i][j] + G[i][j] <= 20;
}

int same(int i, int j, int x, int y) {
    return dist(i, j, x, y) <= 20;
}

int color_number() {
    vector<pair<int, int>> cols;

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            bool any = false;

            for (auto [x, y] : cols) {
                if (same(i, j, x, y)) {
                    any = true;
                    break;
                }
            }

            if (!any) {
                cols.emplace_back(i, j);
            }
        }
    }

    return cols.size();
}

int black_number() {
    int ans = 0;

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if (black(i, j)) {
                ans += 1;
            }
        }
    }

    return ans;
}

int check1() {

}

int check2() {

}

int check3() {

}

int check4() {

}

int style(int n, int m, int R[500][500], int G[500][500], int B[500][500]) {
    memcpy(::R, R, sizeof(::R)), memcpy(::G, G, sizeof(::G)), memcpy(::B, B, sizeof(::B));
    ::n = n, ::m = m;

    int color_cnt = color_number();
    int black_cnt = black_number();

    if (color_cnt > 20 && black_cnt > 10) {
        return 3;
    }
    if (color_cnt < 10 && black_cnt > 10) {
        return 1;
    }
    if (color_cnt < 10) {
        return 4;
    }

    return 2;
}

컴파일 시 표준 에러 (stderr) 메시지

artclass.cpp: In function 'int check1()':
artclass.cpp:59:1: warning: no return statement in function returning non-void [-Wreturn-type]
   59 | }
      | ^
artclass.cpp: In function 'int check2()':
artclass.cpp:63:1: warning: no return statement in function returning non-void [-Wreturn-type]
   63 | }
      | ^
artclass.cpp: In function 'int check3()':
artclass.cpp:67:1: warning: no return statement in function returning non-void [-Wreturn-type]
   67 | }
      | ^
artclass.cpp: In function 'int check4()':
artclass.cpp:71:1: warning: no return statement in function returning non-void [-Wreturn-type]
   71 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...