Submission #100362

#TimeUsernameProblemLanguageResultExecution timeMemory
100362MatesV13Konj (COCI19_konj)C++11
42 / 70
75 ms9052 KiB
#include <bits/stdc++.h> using namespace std; int n, a, b, c, d, x, y; int U=1000, D, L=1000 ,R; char konj[305][305]; bool v[305][305]; void dfs(int x, int y){ v[x][y]=1; U = min(U,x); D = max(D,x); L = min(L,y); R = max(R,y); if (x-1>=0 and !v[x-1][y] and konj[x-1][y]=='#') dfs(x-1,y); if (y-1>=0 and !v[x][y-1] and konj[x][y-1]=='#') dfs(x,y-1); if (!v[x+1][y] and konj[x+1][y]=='#') dfs(x+1,y); if (!v[x][y+1] and konj[x][y+1]=='#') dfs(x,y+1); return; } int main (){ ios::sync_with_stdio(0); cin.tie(0); for (int i=0;i<=301;i++){ for (int j=0;j<=301;j++){ konj[i][j]='.'; } } cin >> n; for (int i=0;i<n;i++){ cin >> a >> b >> c >> d; for (int i=min(a,c);i<=max(a,c);i++){ for (int j=min(b,d);j<=max(b,d);j++){ konj[j][i]='#'; } } } cin >> x >> y; dfs(y,x); for (int i=D;i>=U;i--){ for (int j=L;j<=R;j++){ cout << konj[i][j]; } cout << endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...