Submission #739305

# Submission time Handle Problem Language Result Execution time Memory
739305 2023-05-10T10:11:11 Z grossly_overconfident Art Class (IOI13_artclass) C++17
Compilation error
0 ms 0 KB
#include "artclass.h"
#include <bits/stdc++.h>
using namespace std;
//int style(int h, int w, vector<vector<int>> r, vector<vector<int>> g, vector<vector<int>> b) {
int style(int h, int w, int r[500][500], int g[500][500], int b[500][500]) {
    int one = 0, two = 0, three = 0, four = 0;
 
    for (int i = 0; i < h; ++i){
        for (int j = 0; j < w; ++j){
            if (g[i][j] + 5 > r[i][j] && g[i][j] > b[i][j] + 5){
                two += 2;
            }
            if (r[i][j] > 170 && g[i][j] > 170 && b[i][j] > 200){
                one += 2;
            }
            if (r[i][j] > g[i][j] + 200 && r[i][j] > b[i][j] + 200){
                four += 1;
            }
            if (b[i][j] > g[i][j] + 200 && b[i][j] > r[i][j] + 200){
                four += 1;
            }
        }
    }
    //cout << one << endl << two << endl << -1 << endl << four << endl;
    if (max(max(one, two), four) < w * h / 5){
        return 3;
    }
    if (two > one && two > four){
        return 2;
    }
    if (four > one && four > two){
        return 4;
    }
    
 
    return 1;
}
int none(){
    int h, w;
    cin >> h >> w;
    vector<vector<int>> r(500, vector<int>(500)), g(500, vector<int>(500)), b(500, vector<int>(500));
    
    for (int i = 0; i < h; ++i){
        for (int j = 0; j < w; ++j){
            cin >> r[i][j] >> g[i][j] >> b[i][j];
        }
    }
    cout << style(h, w, r, g, b);
}

Compilation message

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:6:27: warning: unused variable 'three' [-Wunused-variable]
    6 |     int one = 0, two = 0, three = 0, four = 0;
      |                           ^~~~~
artclass.cpp: In function 'int none()':
artclass.cpp:48:25: error: cannot convert 'std::vector<std::vector<int> >' to 'int (*)[500]'
   48 |     cout << style(h, w, r, g, b);
      |                         ^
      |                         |
      |                         std::vector<std::vector<int> >
artclass.cpp:5:29: note:   initializing argument 3 of 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])'
    5 | int style(int h, int w, int r[500][500], int g[500][500], int b[500][500]) {
      |                         ~~~~^~~~~~~~~~~
artclass.cpp:49:1: warning: no return statement in function returning non-void [-Wreturn-type]
   49 | }
      | ^