Submission #57393

#TimeUsernameProblemLanguageResultExecution timeMemory
57393joaogui1Art Class (IOI13_artclass)C++14
Compilation error
0 ms0 KiB
//#include "artclass.h"
#include <bits/stdc++.h>

using namespace std;

double dist(int a, int b, int c, int x, int y, int z){
  double d = abs(a - x) + abs(b - y) + abs(c - z);
  return d;
}

double mean(int R[500][500], int G[500][500], int B[500][500], int x, int y){
  double ret = 0;
  int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};
  for(int i = 0; i < 4; ++i)
    ret += dist(R[x][y], G[x][y], B[x][y], R[x + dx[i]][y + dy[i]], G[x + dx[i]][y + dy[i]], B[x + dx[i]][y + dy[i]]);
  return ret;
}

int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
    double d = 0;
    for(int i = 1; i < 499; ++i)
      for(int j = 1; j < 499; ++j){
        d += mean(R, G, B, i, j);
      }
    d /= H*W;
    //cout << d << "\n";
    //cout << d << " ";
    if(d < 35)  return 4;
    if(90.0 > d && d > 0) return 1;
    if(200.0 > d && d >= 90.0)  return 2;
    else return 3;
    //return d;
}

Compilation message (stderr)

/tmp/cchh1lkI.o: In function `main':
grader.c:(.text.startup+0x21a): undefined reference to `style'
collect2: error: ld returned 1 exit status