# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
570734 |
2022-05-31T07:59:11 Z |
AGE |
Konj (COCI19_konj) |
C++14 |
|
129 ms |
980 KB |
#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
konj.cpp:40:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
40 | main()
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
468 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
129 ms |
980 KB |
Output is correct |
4 |
Incorrect |
2 ms |
340 KB |
Output isn't correct |
5 |
Incorrect |
7 ms |
468 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
468 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
340 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
10 |
Incorrect |
4 ms |
596 KB |
Output isn't correct |