Submission #575787

# Submission time Handle Problem Language Result Execution time Memory
575787 2022-06-11T09:30:13 Z Mazaalai Art Class (IOI13_artclass) C++17
Compilation error
0 ms 0 KB
#include "artclass.h"

ll r, g, b;
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
    for (int i = 0; i < 500; i++)
    for (int j = 0; j < 500; j++) {
        r += R[i][j];
        g += G[i][j];
        b += B[i][j];
    }
    if (r > 1.5 * (g + b)) return 2;
    map <VI, int> cnts;
    int maxi = 0;
    for (int j = 0; j < 500; j++) {
        ll rr, gg, bb; rr = gg = bb = 0;
        for (int i = 0; i < 500; i++) {
            rr += R[i][j];
            gg += G[i][j];
            bb += B[i][j];
        }
        rr /= 5000;
        gg /= 5000;
        bb /= 5000;
        maxi = max(maxi, ++cnts[{rr, gg, bb}]);
    }
    if (maxi > 400) return 4;
    r /= 500 * 500 * 10;
    g /= 500 * 500 * 10;
    b /= 500 * 500 * 10;
    if (r == g && g == b) return 3;
    return 1;
}

Compilation message

artclass.cpp:3:1: error: 'll' does not name a type
    3 | ll r, g, b;
      | ^~
artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:7:9: error: 'r' was not declared in this scope
    7 |         r += R[i][j];
      |         ^
artclass.cpp:8:9: error: 'g' was not declared in this scope
    8 |         g += G[i][j];
      |         ^
artclass.cpp:9:9: error: 'b' was not declared in this scope
    9 |         b += B[i][j];
      |         ^
artclass.cpp:11:9: error: 'r' was not declared in this scope
   11 |     if (r > 1.5 * (g + b)) return 2;
      |         ^
artclass.cpp:11:20: error: 'g' was not declared in this scope
   11 |     if (r > 1.5 * (g + b)) return 2;
      |                    ^
artclass.cpp:11:24: error: 'b' was not declared in this scope
   11 |     if (r > 1.5 * (g + b)) return 2;
      |                        ^
artclass.cpp:12:5: error: 'map' was not declared in this scope
   12 |     map <VI, int> cnts;
      |     ^~~
artclass.cpp:12:10: error: 'VI' was not declared in this scope
   12 |     map <VI, int> cnts;
      |          ^~
artclass.cpp:12:14: error: expected primary-expression before 'int'
   12 |     map <VI, int> cnts;
      |              ^~~
artclass.cpp:15:9: error: 'll' was not declared in this scope
   15 |         ll rr, gg, bb; rr = gg = bb = 0;
      |         ^~
artclass.cpp:15:24: error: 'rr' was not declared in this scope
   15 |         ll rr, gg, bb; rr = gg = bb = 0;
      |                        ^~
artclass.cpp:15:29: error: 'gg' was not declared in this scope
   15 |         ll rr, gg, bb; rr = gg = bb = 0;
      |                             ^~
artclass.cpp:15:34: error: 'bb' was not declared in this scope
   15 |         ll rr, gg, bb; rr = gg = bb = 0;
      |                                  ^~
artclass.cpp:24:28: error: 'cnts' was not declared in this scope
   24 |         maxi = max(maxi, ++cnts[{rr, gg, bb}]);
      |                            ^~~~
artclass.cpp:24:16: error: 'max' was not declared in this scope; did you mean 'maxi'?
   24 |         maxi = max(maxi, ++cnts[{rr, gg, bb}]);
      |                ^~~
      |                maxi
artclass.cpp:27:5: error: 'r' was not declared in this scope
   27 |     r /= 500 * 500 * 10;
      |     ^
artclass.cpp:28:5: error: 'g' was not declared in this scope
   28 |     g /= 500 * 500 * 10;
      |     ^
artclass.cpp:29:5: error: 'b' was not declared in this scope
   29 |     b /= 500 * 500 * 10;
      |     ^