Submission #962176

#TimeUsernameProblemLanguageResultExecution timeMemory
962176serkanrashidArt Class (IOI13_artclass)C++14
0 / 100
50 ms3420 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])
{
    double avg;
    double r,g,b;
    r = g = b;
    for(int i = 0; i < H; i++)
    {
        for(int j = 0; j < W; j++)
        {
            avg += R[i][j] + G[i][j] + B[i][j];
            r += R[i][j];
            g += G[i][j];
            b += B[i][j];
        }
    }
    avg /= (double)(H*W);
    avg = round(avg);
    if(avg<=90) return 3;
    if(g>=1.5*r&&g>=1.5*b) return 2;
    if(r>=2*b&&g>=2*b) return 4;
    return 1;
}

Compilation message (stderr)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:10:11: warning: 'b' is used uninitialized in this function [-Wuninitialized]
   10 |     r = g = b;
      |         ~~^~~
artclass.cpp:21:9: warning: 'avg' may be used uninitialized in this function [-Wmaybe-uninitialized]
   21 |     avg /= (double)(H*W);
      |     ~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...