Submission #151447

#TimeUsernameProblemLanguageResultExecution timeMemory
151447dolphingarlicKonj (COCI19_konj)C++14
70 / 70
70 ms9592 KiB
#include <bits/stdc++.h> #define sz(c) int(c.size()) #define rep(i,a,b) for (int i=a; i<(b); ++i) #define per(i,a,b) for (int i=(b)-1; i>=(a); --i) using namespace std; using ll = long long; enum { UP, RIGHT, DOWN, LEFT }; int const MAXX=330; bool can[MAXX][MAXX][4]; bool was[MAXX][MAXX]; void flood(int x,int y) { if (was[x][y]) return; was[x][y]=true; if (can[x][y][UP]) flood(x,y+1); if (can[x][y][DOWN]) flood(x,y-1); if (can[x][y][RIGHT]) flood(x+1,y); if (can[x][y][LEFT]) flood(x-1,y); } int main() { cin.tie(0); ios_base::sync_with_stdio(0); cout<<fixed<<setprecision(10); int n; cin>>n; rep(i,0,n) { int a,b,c,d; cin>>a>>b>>c>>d; if (a>c || b>d) { swap(a,c); swap(b,d); } if (a==c) { int x=a; rep(y,b,d) can[x][y][UP]=can[x][y+1][DOWN]=true; } else { int y=b; rep(x,a,c) can[x][y][RIGHT]=can[x+1][y][LEFT]=true; } } { int x,y; cin>>x>>y; flood(x,y); } int a=MAXX,b=MAXX,c=-MAXX,d=-MAXX; rep(x,0,MAXX) rep(y,0,MAXX) if (was[x][y]) { a=min(a,x); b=min(b,y); c=max(c,x); d=max(d,y); } per(y,b,d+1) { rep(x,a,c+1) cout<<(was[x][y]?'#':'.'); cout<<"\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...