Submission #100305

#TimeUsernameProblemLanguageResultExecution timeMemory
100305tpoppoKonj (COCI19_konj)C++14
49 / 70
55 ms568 KiB
#include <bits/stdc++.h> using namespace std; int n; using pii = pair<int,int>; vector<pii> rot = {{1,0},{0,1},{0,-1},{-1,0}}; char mat[400][400]; void draw_point(int a,int b,int c,int d){ for(int x = min(a,c);x<=max(a,c);x++){ mat[x][b] = '@'; } for(int y = min(b,d);y<=max(b,d);y++){ mat[a][y] = '@'; } } int mixp = 1e9; int miyp = 1e9; int maxp = -1e9; int mayp = -1e9; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> n; memset(mat,'.',sizeof(mat)); for(int i=0;i<n;i++){ int a,b,c,d; cin >> a >> b >> c >> d; b = 305 - b; d = 305 - d; draw_point(a,b,c,d); } int x,y; cin >> x >> y; y = 305 - y; queue<pii> coda; coda.push({x,y}); do{ auto cima = coda.front(); coda.pop(); if(cima.first < 0 || cima.second < 0) continue; if(mat[cima.first][cima.second] != '@') continue; mat[cima.first][cima.second] = '#'; mixp = min(mixp,cima.first); maxp = max(maxp,cima.first); miyp = min(miyp,cima.second); mayp = max(mayp,cima.second); for(auto el : rot){ coda.push({el.first + cima.first, el.second + cima.second}); } }while(!coda.empty()); for(int i=miyp;i<=mayp;i++){ for(int j=mixp;j<=maxp;j++){ cout<< (mat[j][i]=='@'?'.':mat[j][i]); }cout<<'\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...