Submission #884922

# Submission time Handle Problem Language Result Execution time Memory
884922 2023-12-08T17:15:26 Z lis13 Art Class (IOI13_artclass) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
int main() {
  int H, W;
  cin >> H >> W;
  int R[H][W]; int G[H][W]; int B[H][W];
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> R[i][j] >> G[i][j] >> B[i][j];
    }
  }
  int tsn=0;
  int sn;
  for (int i = 0; i < H; i++) {
    for (int j = 1; j < W; j++) {
      tsn+=abs(R[j]-R[j-1])+abs(G[j]-G[j-1])+abs(B[j]-B[j-1]);
      sn++;
    }
  }
  double result = tsn / (double) sn;
  if (result < 9) cout << 4;
  else if (result < 18) cout << 1;
  else if (result < 36) cout << 2;
  else cout << 3;
	return 0;
}

Compilation message

artclass.cpp: In function 'int main()':
artclass.cpp:20:25: warning: 'sn' may be used uninitialized in this function [-Wmaybe-uninitialized]
   20 |   double result = tsn / (double) sn;
      |                         ^~~~~~~~~~~
/usr/bin/ld: /tmp/ccD13Ntd.o: in function `main':
artclass.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccU7dowf.o:grader.c:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccU7dowf.o: in function `main':
grader.c:(.text.startup+0x200): undefined reference to `style'
collect2: error: ld returned 1 exit status