Submission #268419

#TimeUsernameProblemLanguageResultExecution timeMemory
268419Toirov_SadiArt Class (IOI13_artclass)C++17
4 / 100
110 ms6196 KiB
#include<bits/stdc++.h>
#include "artclass.h"

using namespace std;

int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
    vector<int> cnt(5);
    for(int i = 0; i < H; i ++){
        for(int j = 0; j < W; j ++){
            if(R[i][j] >= max(G[i][j], B[i][j])) cnt[1] ++;
            if(G[i][j] >= max(R[i][j], B[i][j])) cnt[2] ++;
            if(B[i][j] >= max(R[i][j], G[i][j])) cnt[3] ++;
        }
    }
    if(cnt[2] >= max(cnt[1], cnt[3])) return 2;

    if(max({cnt[1], cnt[2], cnt[3]}) > (H * W) / 2) return 3;

    if(cnt[1] < cnt[2]) swap(cnt[1], cnt[2]);
    if(cnt[2] < cnt[3]) swap(cnt[2], cnt[3]);
    if(cnt[1] < cnt[2]) swap(cnt[1], cnt[2]);

    if(cnt[1] >= cnt[2] * 2) return 4;

    return 1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...