Submission #427099

# Submission time Handle Problem Language Result Execution time Memory
427099 2021-06-14T12:24:31 Z AmineWeslati Art Class (IOI13_artclass) C++14
Compilation error
0 ms 0 KB
#include "artclass.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int>vi; 
#define pb push_back
#define sz(v) (int)v.size()

typedef pair<int,int>pi;
#define fi first
#define se second
typedef vector<pi>vpi;
#define eb emplace_back

#define FOR(i,a,b) for(int i=a; i<b; i++)
#define ROF(i,a,b) for(int i=b-1; i>=a; i--)


void ckmax(int &x, int y){x=max(x,y);}
void ckmin(int &x, int y){x=min(x,y);}

const int MX=1e5+10;
//-----------------------------

int style(int N, int M, int R[500][500], int G[500][500], int B[500][500]) {
    cnt=0;
    FOR(i,0,N) FOR(j,0,M){
        if(G[i][j]>R[i][j] && G[i][j]>B[i][j]) cnt++;
    }
    if(cnt>=(N*M)/2) return 2;

    cnt=0;
    FOR(i,0,N) FOR(j,0,M){
        if(R[i][j]>B[i][j] && R[i][j]>G[i][j]) cnt++;
    }
    if(cnt>=(N*M)/2) return 4;

    cnt=0;
    FOR(i,0,N) FOR(j,0,M){
        if(B[i][j]>R[i][j] && B[i][j]>G[i][j]) cnt++;
    }
    if(cnt>=(N*M)/2) return 4;

    return 1;
}

Compilation message

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:27:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
   27 |     cnt=0;
      |     ^~~
      |     int