Submission #570733

#TimeUsernameProblemLanguageResultExecution timeMemory
570733AGEKonj (COCI19_konj)C++14
21 / 70
139 ms3544 KiB
#include<bits/stdc++.h> #define F first #define S second #define pb push_back #define int long long using namespace std; const int N=1e6,M=2e3; int maxx,maxy,minx,miny; map< pair<int,int>, int> vis; map< pair<int,int> , vector< pair<int,int> > > adj; int ans[301][301]; void dfs(int xnode,int ynode){ vis[{xnode,ynode}]=1; for(auto x:adj[{xnode,ynode}]){ if(vis[x]==1) continue; minx=min(minx,x.F); miny=min(miny,x.S); maxx=max(maxx,x.F); maxy=max(maxy,x.S); for(int i=xnode;i<=x.F;i++){ for(int j=ynode;j<=x.S;j++){ ans[i][j]=1; } } dfs(x.F,x.S); } } main() { int n; cin>>n; /*for(int i=0;i<n;i++){ int a,b,c,d; cin>>a>>b>>c>>d; adj[{a,b}].pb({c,d}); }*/ maxx=-1e18,minx=1e18,maxy=-1e18,miny=1e18; for(int i=0;i<n;i++){ int a,b,c,d; cin>>a>>c>>b>>d; for(int i=min(a,b);i<=max(a,b);i++) for(int j=min(c,d);j<=max(c,d);j++) ans[i][j]=1; minx=min(minx,min(a,b)); miny=min(miny,min(c,d)); maxx=max(maxx,max(a,b)); maxy=max(maxy,max(c,d)); } int x,y; cin>>x>>y; ans[x][y]=1; //dfs(x,y); for(int j=maxy;j>=miny;j--){ for(int i=minx;i<=maxx;i++){ if(ans[i][j]==1) cout<<"#"; else cout<<"."; } cout<<endl; } return 0; } /* 2 2 6 2 2 2 2 6 6 2 6 4 6 4 6 6 2 6 6 6 6 2 8 2 8 2 10 2 10 2 12 2 12 2 12 4 12 4 6 4 6 2 6 1 8 2 8 0 10 2 10 1 12 2 12 0 42 42 42 43 2 2 */

Compilation message (stderr)

konj.cpp:40:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   40 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...