Submission #157972

#TimeUsernameProblemLanguageResultExecution timeMemory
157972NachoLibreArt Class (IOI13_artclass)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include "artclass.h" const int BK = 150, WK = 200; bool iswh(int r, int g, int b) { if(min(r, min(g, b)) >= WK && max(r, max(b, g)) - min(r, min(g, b)) <= 30) return 1; return 0; } bool isbl(int r, int g, int b) { if(r + g + b <= BK) return 1; return 0; } bool isgr(int r, int g, int b) { if(g >= (r + b) * 2) return 1; return 0; } bool isgr(int r, int g, int b) { if(r + g + b <= 540 && max(r, max(b, g)) - min(r, min(g, b)) <= 50) return 1; return 0; } int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { int w = 0, b = 0, g = 0, int gr = 0; for(int i = 0; i < H; ++i) { for(int j = 0; j < W; ++j) { if(iswh(R[i][j], G[i][j], B[i][j])) ++w; if(isbl(R[i][j], G[i][j], B[i][j])) ++b; if(isgr(R[i][j], G[i][j], B[i][j])) ++g; if(isgr(R[i][j], G[i][j], B[i][j])) ++gr; } } if(g * 3 >= H * W) return 2; if(w * 3 >= H * W) return 1; if(b * 15 >= H * W && gr * 7 >= H * W) return 3; return 4; }

Compilation message (stderr)

artclass.cpp: In function 'bool isgr(int, int, int)':
artclass.cpp:22:6: error: redefinition of 'bool isgr(int, int, int)'
 bool isgr(int r, int g, int b) {
      ^~~~
artclass.cpp:17:6: note: 'bool isgr(int, int, int)' previously defined here
 bool isgr(int r, int g, int b) {
      ^~~~
artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:28:27: error: expected unqualified-id before 'int'
  int w = 0, b = 0, g = 0, int gr = 0;
                           ^~~
artclass.cpp:34:42: error: 'gr' was not declared in this scope
    if(isgr(R[i][j], G[i][j], B[i][j])) ++gr;
                                          ^~
artclass.cpp:34:42: note: suggested alternative: 'g'
    if(isgr(R[i][j], G[i][j], B[i][j])) ++gr;
                                          ^~
                                          g
artclass.cpp:39:24: error: 'gr' was not declared in this scope
  if(b * 15 >= H * W && gr * 7 >= H * W) return 3;
                        ^~
artclass.cpp:39:24: note: suggested alternative: 'g'
  if(b * 15 >= H * W && gr * 7 >= H * W) return 3;
                        ^~
                        g