제출 #1168002

#제출 시각아이디문제언어결과실행 시간메모리
1168002zh_hCollecting Mushrooms (NOI18_collectmushrooms)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define pb push_back using namespace std; int main() { int R, C, D, K; cin >> R >> C >> D >> K; vector<vector<char>> grid(R, vector<char>(C)) vector<pair<int, int>> splinter; for (int i = 0; i < R; i ++) { for (int j = 0; j < C; j ++) { char temp; cin >> temp; grid[R][C] = temp; if (temp == 'S') { splinter.pb({i, j}); } } } vector<vector<int>> mushroom(R, vector<int>(C)); int harvestable_mushroom = 0; for (int z = 0; z < splinter.size(); z ++) { int x = splinter[z].first, y = splinter[z].second; int first_row = min(0, x-D), last_row = max(R-1, x+D); int first_col = min(0, y-D), last_col = max(C-1, y+D); for (int i = first_row; i <= last_row; i ++) { for (int j = firt_col; j <= lasr_col; j ++) { if (grid[i][j] == 'M') { mushroom[i][j]++; } if (mushroom[i][j] >= K) { grid[i][j] == '.'; harvestable_mushroom ++; } } } } cout << harvestable_mushroom << endl; }

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

mushrooms.cpp: In function 'int main()':
mushrooms.cpp:10:5: error: expected ',' or ';' before 'vector'
   10 |     vector<pair<int, int>> splinter;
      |     ^~~~~~
mushrooms.cpp:18:17: error: 'splinter' was not declared in this scope
   18 |                 splinter.pb({i, j});
      |                 ^~~~~~~~
mushrooms.cpp:26:25: error: 'splinter' was not declared in this scope
   26 |     for (int z = 0; z < splinter.size(); z ++) {
      |                         ^~~~~~~~
mushrooms.cpp:30:32: error: 'y' was not declared in this scope
   30 |         int first_col = min(0, y-D), last_col = max(C-1, y+D);
      |                                ^
mushrooms.cpp:33:26: error: 'firt_col' was not declared in this scope; did you mean 'first_col'?
   33 |             for (int j = firt_col; j <= lasr_col; j ++) {
      |                          ^~~~~~~~
      |                          first_col
mushrooms.cpp:33:41: error: 'lasr_col' was not declared in this scope
   33 |             for (int j = firt_col; j <= lasr_col; j ++) {
      |                                         ^~~~~~~~