#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)/2)
#define all(x) x.begin(),x.end()
#define pw(x) (1<<(x))
#define inf 100000009
#define MOD 998244353
#define N 100005
#define M 2500005
#define LOG 20
#define KOK 300
#define EPS 0.0000001
using namespace std;
int n,x,y;
int mnx=inf,mny=inf,mxx=-inf,mxy=-inf;
char a[305][305];
int vis[N];
vector<int> has[305][305];
pair<ii,ii> cur[N];
bool inside(int w) {
return (cur[w].st.st-x)*(cur[w].st.nd-cur[w].nd.nd)==(cur[w].st.nd-y)*(cur[w].st.st-cur[w].nd.st);
}
void doit(int fx,int fy,int sx,int sy) {
int g=__gcd(abs(fx-sx),abs(fy-sy));
int dx=abs(fx-sx)/g;
int dy=abs(fy-sy)/g;
if(fx>sx || fy>sy) {
swap(fx,sx);
swap(fy,sy);
}
for(;fx<=sx && fy<=sy;fx+=dx,fy+=dy) {
a[fx][fy]='#';
umin(mnx,fx);
umax(mxx,fx);
umin(mny,fy);
umax(mxy,fy);
}
}
void dfs(int w) {
if(vis[w]) return ;
vis[w]=1;
int fx=cur[w].st.st;
int fy=cur[w].st.nd;
int sx=cur[w].nd.st;
int sy=cur[w].nd.nd;
doit(fx,fy,sx,sy);
while(sz(has[fx][fy])) {
int go=has[fx][fy].back();
has[fx][fy].ppb();
dfs(go);
}
while(sz(has[sx][sy])) {
int go=has[sx][sy].back();
has[sx][sy].ppb();
dfs(go);
}
}
int main() {
scanf("%d",&n);
for(int i=1;i<=n;i++) {
int a,b,c,d;
scanf("%d %d %d %d",&a,&b,&c,&d);
cur[i]={{a,b},{c,d}};
has[a][b].pb(i);
has[c][d].pb(i);
}
scanf("%d %d",&x,&y);
for(int i=1;i<=n;i++) {
if(inside(i)) {
dfs(i);
}
}
for(int j=mxy;j>=mny;j--) {
for(int i=mnx;i<=mxx;i++) {
if(a[i][j]!='#') a[i][j]='.';
printf("%c",a[i][j]);
}
printf("\n");
}
}
Compilation message
konj.cpp: In function 'int main()':
konj.cpp:105:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
~~~~~^~~~~~~~~
konj.cpp:111:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d %d %d",&a,&b,&c,&d);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
konj.cpp:120:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d",&x,&y);
~~~~~^~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
2560 KB |
Output is correct |
2 |
Correct |
5 ms |
2560 KB |
Output is correct |
3 |
Runtime error |
84 ms |
15324 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Correct |
5 ms |
2560 KB |
Output is correct |
5 |
Correct |
5 ms |
2560 KB |
Output is correct |
6 |
Correct |
4 ms |
2560 KB |
Output is correct |
7 |
Incorrect |
5 ms |
2560 KB |
Output isn't correct |
8 |
Correct |
4 ms |
2560 KB |
Output is correct |
9 |
Correct |
5 ms |
2560 KB |
Output is correct |
10 |
Correct |
4 ms |
2560 KB |
Output is correct |