Submission #937780

#TimeUsernameProblemLanguageResultExecution timeMemory
937780LudisseyArt Class (IOI13_artclass)C++14
3 / 100
51 ms6228 KiB
#include "artclass.h"

int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
    int black=0;    
    int green=0;    
    int redyellow=0;    

    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if(R[i][j]+G[i][j]+B[i][j]<4) black++; 
            else if(G[i][j]>200&&G[i][j]+B[i][j]<100) green++;
            else if((R[i][j]>200||G[i][j]>100&&R[i][j]>100)&&B[i][j]<60) redyellow++;
        }
    }
    if(black>(H*W)/30) return 1;
    else if(green>(H*W)/10) return 2;
    else if(redyellow>(H*W)/5) return 4;
    return 3;
}

Compilation message (stderr)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:14:46: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   14 |             else if((R[i][j]>200||G[i][j]>100&&R[i][j]>100)&&B[i][j]<60) redyellow++;
      |                                   ~~~~~~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...