Submission #301090

#TimeUsernameProblemLanguageResultExecution timeMemory
301090BlancaHM미술 수업 (IOI13_artclass)C++14
Compilation error
0 ms0 KiB
import <cmath> using namespace std; int diffValue(int H, int W, int red[500][500], int green[500][500], int blue[500][500]) { int ans = 0; for (int i = 1; i < 500; i++) { ans += abs(red[0][i] - red[0][i-1]); ans += abs(red[i][0] - red[i-1][0]); ans += abs(green[0][i] - green[0][i-1]); ans += abs(green[i][0] - green[i-1][0]); ans += abs(blue[0][i] - blue[0][i-1]); ans += abs(blue[i][0] - blue[i-1][0]); } for (int i = 1; i < 500; i++) { for (int j = 1; j < 500; j++) { ans += abs(red[i][j] - red[i][j-1]); ans += abs(red[i][j] - red[i-1][j]); ans += abs(green[i][j] - green[i][j-1]); ans += abs(green[i][j] - green[i-1][j]); ans += abs(blue[i][j] - blue[i][j-1]); ans += abs(blue[i][j] - blue[i-1][j]); } } return ans; } int vertValue(int H, int W, int red[500][500], int green[500][500], int blue[500][500]) { int ans = 0; for (int i = 1; i < 500; i++) { ans += abs(red[i][0] - red[i-1][0]); ans += abs(green[i][0] - green[i-1][0]); ans += abs(blue[i][0] - blue[i-1][0]); } for (int i = 1; i < 500; i++) { for (int j = 1; j < 500; j++) { ans += abs(red[i][j] - red[i-1][j]); ans += abs(green[i][j] - green[i-1][j]); ans += abs(blue[i][j] - blue[i-1][j]); } } return ans; } int horiValue(int H, int W, int red[500][500], int green[500][500], int blue[500][500]) { int ans = 0; for (int i = 1; i < 500; i++) { ans += abs(red[0][i] - red[0][i-1]); ans += abs(green[0][i] - green[0][i-1]); ans += abs(blue[0][i] - blue[0][i-1]); } for (int i = 1; i < 500; i++) { for (int j = 1; j < 500; j++) { ans += abs(red[i][j] - red[i][j-1]); ans += abs(green[i][j] - green[i][j-1]); ans += abs(blue[i][j] - blue[i][j-1]); } } return ans; } int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { int val = diffValue(H, W, R, G, B); if (val >= 25000000) return 3; val = horiValue(H, W, R, G, B); if (val >= 6500000) return 2; val = vertValue(H, W, R, G, B); if (val <= 2500000) return 1; else return 4; }

Compilation message (stderr)

artclass.cpp:1:1: error: 'import' does not name a type
    1 | import <cmath>
      | ^~~~~~
artclass.cpp: In function 'int diffValue(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:7:10: error: 'abs' was not declared in this scope; did you mean 'ans'?
    7 |   ans += abs(red[0][i] - red[0][i-1]);
      |          ^~~
      |          ans
artclass.cpp:16:11: error: 'abs' was not declared in this scope; did you mean 'ans'?
   16 |    ans += abs(red[i][j] - red[i][j-1]);
      |           ^~~
      |           ans
artclass.cpp: In function 'int vertValue(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:30:10: error: 'abs' was not declared in this scope; did you mean 'ans'?
   30 |   ans += abs(red[i][0] - red[i-1][0]);
      |          ^~~
      |          ans
artclass.cpp:36:11: error: 'abs' was not declared in this scope; did you mean 'ans'?
   36 |    ans += abs(red[i][j] - red[i-1][j]);
      |           ^~~
      |           ans
artclass.cpp: In function 'int horiValue(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:47:10: error: 'abs' was not declared in this scope; did you mean 'ans'?
   47 |   ans += abs(red[0][i] - red[0][i-1]);
      |          ^~~
      |          ans
artclass.cpp:53:11: error: 'abs' was not declared in this scope; did you mean 'ans'?
   53 |    ans += abs(red[i][j] - red[i][j-1]);
      |           ^~~
      |           ans