제출 #518859

#제출 시각아이디문제언어결과실행 시간메모리
518859SHZhang미술 수업 (IOI13_artclass)C++14
컴파일 에러
0 ms0 KiB
#include "artclass.h" #include <cstdio> #include <vector> using namespace std; double dis(int a, int b, int c, int d, int e, int f) { return (double)((a-d)*(a-d) + (b-e)*(b-e) + (c-f)*(c-f)); } bool used[16][16][16]; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { double var = 0.0; vector<double> varvec; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { //used[R[i][j] / 16][G[i][j] / 16][B[i][j] / 16] = true; double tot = 0.0; int cnt = 0; for (int k = -5; k <= 5; k++) { for (int l = -5; l <= 5; l++) { if (i + k >= 0 && i + k < H && j + l >= 0 && j + l < W) { tot += dis(R[i][j], G[i][j], B[i][j], R[i+k][j+l], G[i+k][j+l], B[i+k][j+l]); cnt++; } } } var += tot / (double)cnt; varvec.push_back(tot / (double)cnt); } } sort(varvec.begin(), varvec.end()); /*int usecnt = 0; for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { for (int k = 0; k < 16; k++) { if (used[i][j][k]) usecnt++; } } }*/ double varavg = var / (double)(H*W); double varlowmed = varvec[(H*W)/3]; if (varlowmed <= 435.0) { if (varavg <= 1400.0) return 4; return 1; } else { if (varlowmed + varavg <= 8000.0) return 2; return 3; } }

컴파일 시 표준 에러 (stderr) 메시지

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:34:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   34 |     sort(varvec.begin(), varvec.end());
      |     ^~~~
      |     short