제출 #1191133

#제출 시각아이디문제언어결과실행 시간메모리
1191133itslqSquare or Rectangle? (NOI19_squarerect)C++20
컴파일 에러
0 ms0 KiB
int searchRight(int x, int right, int y) { int l = x + 1, r = right, m, ans = x; while (l <= r) { m = (l + r) >> 1; if (inside_shape(m, y)) { ans = m; l = ++m; } else r = --m; } return ans; } int searchLeft(int x, int left, int y) { int l = left, r = x - 1, m, ans = x; while (l <= r) { m = (l + r) >> 1; if (inside_shape(m, y)) { ans = m; r = --m; } else l = ++m; } return ans; } int searchUp(int y, int up, int x) { int l = y + 1, r = up, m, ans = y; while (l <= r) { m = (l + r) >> 1; if (inside_shape(x, m)) { ans = m; l = ++m; } else r = --m; } return ans; } bool am_i_square(int N, int Q) { vector<vector<int>> qrys(4, vector<int>(4)); int mx = 100, my = 100, Mx = -1, My = -1; for (int i = 1; i <= 4; i++) { for (int j = 1; j <= 4; j++) { if (inside_shape(i * 20, j * 20)) { mx = min(mx, i); my = min(my, i); Mx = max(Mx, i); My = max(My, i); } } } if (Mx == -1) { bool found = false; for (int i = 1; i <= 5; i++) { if (inside_shape(i * 20, 100)) { if (found) return false; found = true; int lb = searchLeft(i * 20, max(1, i * 20 - 19), 100); if (lb + 19 >= 100 || !inside_shape(lb + 19, 100) || (lb + 20 <= 100 && inside_shape(lb + 20, 100)) || !inside_shape(i * 20, 81) || inside_shape(i * 20, 80) ) return false; } } for (int i = 1; i <= 4; i++) { if (inside_shape(100, i * 20)) { if (found) return false; found = true; int ub = searchUp(i * 20, i * 20 + 19, 100); if (!inside_shape(100, ub - 19) || inside_shape(100, ub - 20) || !inside_shape(81, i * 20) || inside_shape(80, i * 20) ) return false; } } return found; } else { int lb = searchLeft(mx * 20, max(1, mx * 20 - 19), my * 20); int rb = searchRight(Mx * 20, Mx * 20 + 19, my * 20); int ub = searchUp(My * 20, My * 20 + 19, My * 20); int db = ub - rb + lb; if (db < 1 || !inside_shape(mx * 20, db) || (db - 1 >= 1 && inside_shape(mx * 20, db - 1)) ) return false; return true; } }

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

squarerect.cpp: In function 'int searchRight(int, int, int)':
squarerect.cpp:5:21: error: 'inside_shape' was not declared in this scope
    5 |                 if (inside_shape(m, y)) {
      |                     ^~~~~~~~~~~~
squarerect.cpp: In function 'int searchLeft(int, int, int)':
squarerect.cpp:17:21: error: 'inside_shape' was not declared in this scope
   17 |                 if (inside_shape(m, y)) {
      |                     ^~~~~~~~~~~~
squarerect.cpp: In function 'int searchUp(int, int, int)':
squarerect.cpp:29:21: error: 'inside_shape' was not declared in this scope
   29 |                 if (inside_shape(x, m)) {
      |                     ^~~~~~~~~~~~
squarerect.cpp: In function 'bool am_i_square(int, int)':
squarerect.cpp:39:16: error: 'vector' was not declared in this scope
   39 |         vector<vector<int>> qrys(4, vector<int>(4));
      |                ^~~~~~
squarerect.cpp:39:23: error: expected primary-expression before 'int'
   39 |         vector<vector<int>> qrys(4, vector<int>(4));
      |                       ^~~
squarerect.cpp:45:29: error: 'inside_shape' was not declared in this scope
   45 |                         if (inside_shape(i * 20, j * 20)) {
      |                             ^~~~~~~~~~~~
squarerect.cpp:46:38: error: 'min' was not declared in this scope
   46 |                                 mx = min(mx, i);
      |                                      ^~~
squarerect.cpp:48:38: error: 'max' was not declared in this scope; did you mean 'mx'?
   48 |                                 Mx = max(Mx, i);
      |                                      ^~~
      |                                      mx
squarerect.cpp:57:29: error: 'inside_shape' was not declared in this scope
   57 |                         if (inside_shape(i * 20, 100)) {
      |                             ^~~~~~~~~~~~
squarerect.cpp:61:61: error: 'max' was not declared in this scope; did you mean 'mx'?
   61 |                                 int lb = searchLeft(i * 20, max(1, i * 20 - 19), 100);
      |                                                             ^~~
      |                                                             mx
squarerect.cpp:72:29: error: 'inside_shape' was not declared in this scope
   72 |                         if (inside_shape(100, i * 20)) {
      |                             ^~~~~~~~~~~~
squarerect.cpp:88:46: error: 'max' was not declared in this scope; did you mean 'mx'?
   88 |                 int lb = searchLeft(mx * 20, max(1, mx * 20 - 19), my * 20);
      |                                              ^~~
      |                                              mx
squarerect.cpp:94:26: error: 'inside_shape' was not declared in this scope
   94 |                         !inside_shape(mx * 20, db) ||
      |                          ^~~~~~~~~~~~