Submission #1028649

#TimeUsernameProblemLanguageResultExecution timeMemory
1028649tolbiArt Class (IOI13_artclass)C++17
65 / 100
71 ms6200 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]) {
    function<bool(int,int)> white = [&](int a, int b){
        if (R[a][b]>150 && G[a][b]>150 && B[a][b]>150) return true;
        return false;
    };
    function<bool(int,int)> black = [&](int a, int b){
        if (R[a][b]<70 && G[a][b]<70 && B[a][b]<70) return true;
        return false;
    };
    int totdiff = 0;
    int hehe = 0;
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            if (i) {
                totdiff+=max(10,abs(R[i][j]-R[i-1][j]));
                totdiff+=max(10,abs(G[i][j]-G[i-1][j]));
                totdiff+=max(10,abs(B[i][j]-B[i-1][j]));
                if (black(i,j) && white(i-1,j)){
                    hehe++;
                }
                if (black(i-1,j) && white(i,j)){
                    hehe++;
                }
            }
            if (j) {
                totdiff+=max(10,abs(R[i][j]-R[i][j-1]));
                totdiff+=max(10,abs(G[i][j]-G[i][j-1]));
                totdiff+=max(10,abs(B[i][j]-B[i][j-1]));
                if (black(i,j) && white(i,j-1)){
                    hehe++;
                }
                if (white(i,j) && black(i,j-1)){
                    hehe++;
                }
            }
        }
    }
    if (totdiff>20000000) return 3;
    if (hehe>30) return 1;
    if (totdiff>15000000) return 2;
    return 4;
}
#Verdict Execution timeMemoryGrader output
Fetching results...