제출 #532204

#제출 시각아이디문제언어결과실행 시간메모리
532204TheWilp미술 수업 (IOI13_artclass)C++14
0 / 100
69 ms9264 KiB
#include "artclass.h" #include <iostream> #include <vector> class name { public: name(int a, int b) { x = a; y = b; } int x; int y; }; int Ge(int a,int g) { a /= g; return a; } int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { double style1 = 0; double style2 = 0; double style3 = 0; double style4 = 0; // style2 int s2[3]; const int generalize1 = 2; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { s2[0] = Ge(R[i][j], generalize1); s2[1] = Ge(G[i][j], generalize1); s2[2] = Ge(B[i][j], generalize1); if (s2[1] > s2[2] * 1.3); style2++; } } // else int s1[3][500][500]; const int generalize2 = 64; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { s1[0][i][j] = Ge(R[i][j], generalize2); s1[1][i][j] = Ge(G[i][j], generalize2); s1[2][i][j] = Ge(B[i][j], generalize2); } } int s[500][500]; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { s[i][j] = 0; } } int block = 0; std::vector<name> v; int i = 0; for (int q = 0; q < H; q++) { for (int w = 0; w < W; w++) { while (i != v.size()) { int x = v[i].x; int y = v[i].y; if (x != 0) { if (s[x - 1][y] == 0 && s1[x][y] == s1[x - 1][y]) { v.push_back(name(x - 1, y)); s[x - 1][y] = 1; } } if (x != H - 1) { if (s[x + 1][y] == 0 && s1[x][y] == s1[x + 1][y]) { v.push_back(name(x + 1, y)); s[x + 1][y]; } } if (y != 0){ if (s[x][y - 1] == 0 && s1[x][y] == s1[x][y - 1]) { v.push_back(name(x, y - 1)); s[x][y - 1]; } } if (y != W - 1) { if (s[x][y + 1] == 0 && s1[x][y] == s1[x][y + 1]) { v.push_back(name(x, y + 1)); s[x][y + 1]; } } ++i; } if (s[q][w] == 0) { v.push_back(name(q,w)); ++block; } } } if (style2 >= 60 * H * W / 100) return 2; if (block <= 6) return 4; if (block <= 100) return 1; else return 4; return 1; }

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

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:32:13: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   32 |             if (s2[1] > s2[2] * 1.3);
      |             ^~
artclass.cpp:33:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   33 |                 style2++;
      |                 ^~~~~~
artclass.cpp:59:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<name>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |             while (i != v.size()) {
      |                    ~~^~~~~~~~~~~
artclass.cpp:71:35: warning: statement has no effect [-Wunused-value]
   71 |                         s[x + 1][y];
      |                         ~~~~~~~~~~^
artclass.cpp:78:35: warning: statement has no effect [-Wunused-value]
   78 |                         s[x][y - 1];
      |                         ~~~~~~~~~~^
artclass.cpp:84:35: warning: statement has no effect [-Wunused-value]
   84 |                         s[x][y + 1];
      |                         ~~~~~~~~~~^
artclass.cpp:18:12: warning: unused variable 'style1' [-Wunused-variable]
   18 |     double style1 = 0;
      |            ^~~~~~
artclass.cpp:20:12: warning: unused variable 'style3' [-Wunused-variable]
   20 |     double style3 = 0;
      |            ^~~~~~
artclass.cpp:21:12: warning: unused variable 'style4' [-Wunused-variable]
   21 |     double style4 = 0;
      |            ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...