제출 #1223399

#제출 시각아이디문제언어결과실행 시간메모리
1223399iulia_morariuPaint (COI20_paint)C++20
컴파일 에러
0 ms0 KiB
#include <algorithm> #include <iostream> #include <fstream> #include <climits> #include <vector> #include <stack> #include <cmath> #include <queue> // #include <bits/stdc++.h> #define in cin #define out cout #define mkp make_pair using namespace std; vector< vector<int> > v; int ox[] = {0, 0, 1, -1}; int oy[] = {1, -1, 0, 0}; void fill(int x, int y, int c){ int ini = v[x][y]; if(ini == c) return; v[x][y] = c; queue< pair<int, int> > q; q.push( mkp(x, y) ); while(!q.empty()){ x = q.front().first; y = q.front().second; q.pop(); v[x][y] = c; for(int i = 0; i < 4; i++){ if(x + ox[i] < 0 || x + ox[i] >= v.size() || y + oy[i] < 0 || y + oy[i] >= v[x].size()) continue; if(v[x + ox[i]][y + oy[i]] == ini){ q.push(mkp(x + ox[i], y + oy[i])); } } } } signed main(){ ios_base::sync_with_stdio(false); in.tie(NULL); int n, m; in >> n >> m; v.resize(n); for(int i = 0; i < n; i++) v[i].resize(m); for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++) in >> v[i][j]; } if(q <= 10000 && n * m * q <= 300000000){ int q; in >> q; for(int i = 0; i < q; i++){ int x, y, c; in >> x >> y >> c; x--; y--; fill(x, y, c); } for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++) out << v[i][j] << " "; out << '\n'; } return 0; } return 0; }

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

paint.cpp: In function 'int main()':
paint.cpp:52:8: error: 'q' was not declared in this scope
   52 |     if(q <= 10000 && n * m * q <= 300000000){
      |        ^
paint.cpp:53:13: error: redeclaration of 'int q'
   53 |         int q; in >> q;
      |             ^
paint.cpp:52:8: note: '<typeprefixerror>q' previously declared here
   52 |     if(q <= 10000 && n * m * q <= 300000000){
      |        ^