Submission #43827

#TimeUsernameProblemLanguageResultExecution timeMemory
43827PowerOfNinjaGoArt Class (IOI13_artclass)C++14
Compilation error
0 ms0 KiB
//Power Of Ninja Go
#include <bits/stdc++.h>
#ifdef atom
    #include "gradertxt.c"
#else
    #include "artclass.h"
#endif
using namespace std;
typedef long long ll; typedef pair<int, int> ii;
#define X first
#define Y second
#define vi vector<int>
#define vii vector< ii >
#define pb push_back
int sq(int x){ return x*x;}
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500])
{
    double res = 0;
    int n = H, m = W;
    double res = 0;
    int n = DIM[0], m = DIM[1];
    double cntdiff = 0;
    for(int i = 0; i< n; i++)
    {
        for(int j = 0; j< m; j++)
        {
            int tmp = 0;
            double r = 0, g = 0, b = 0;
            for(int p = 0; p< 4; p++)
            {
                int ni = i+dx[p], nj = j+dy[p];
                if(ni< 0 || ni>= n || nj< 0 || nj>= m) continue;
                r += R[ni][nj], g += G[ni][nj], b += B[ni][nj];
                tmp++;
            }
            r /= tmp; g /= tmp; b/= tmp;
            double val = sqrt((sq(r-R[i][j])+sq(g-G[i][j])+sq(b-B[i][j]))/3);
            if(val> 50) cntdiff++;
            res += val;
        }
    }
    double tot = 0;
    for(int i = 0; i< n; i++)
    {
        for(int j = 0; j< m; j++)
        {
            tot += R[i][j] +G[i][j] + B[i][j];
        }
    }
    res /= n*m;
    tot /= n*m;
    cntdiff /= n*m;
    if(res> 10) return 3;
    else if(res< 1.5) return 4;
    else if(tot>= 380) return 1;
    return 2;
}

Compilation message (stderr)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:22:12: error: redeclaration of 'double res'
     double res = 0;
            ^~~
artclass.cpp:20:12: note: 'double res' previously declared here
     double res = 0;
            ^~~
artclass.cpp:23:9: error: redeclaration of 'int n'
     int n = DIM[0], m = DIM[1];
         ^
artclass.cpp:21:9: note: 'int n' previously declared here
     int n = H, m = W;
         ^
artclass.cpp:23:13: error: 'DIM' was not declared in this scope
     int n = DIM[0], m = DIM[1];
             ^~~
artclass.cpp:23:13: note: suggested alternative: 'EDOM'
     int n = DIM[0], m = DIM[1];
             ^~~
             EDOM