#include<bits/stdc++.h>
#define int long long
using namespace std;
int n, i, j, k, a, b, c, d, ca, db, A[100010], B[100010], C[100010], D[100010];
vector<pair<int, int> >v, ans;
main()
{
for(scanf("%lld", &n);i++<n;)
{
scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
A[i]=a;
B[i]=b;
C[i]=c;
D[i]=d;
if(i==1)
{
ca=c-a;
db=d-b;
}
v.push_back({ca*b-db*a, i});
}
sort(v.begin(), v.end());
for(i=1;i<v.size();i++)
{
if(v[i].first!=v[i-1].first)
{
a=i-1;
ans.push_back({v[a].second, v[i].second});
}
else
{
ans.push_back({v[a].second, v[i].second});
}
}
for(auto p:ans)printf("%lld %lld %lld %lld\n", A[p.first], B[p.first], A[p.second], B[p.second]);
}
Compilation message
roads.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | main()
| ^~~~
roads.cpp: In function 'int main()':
roads.cpp:23:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
23 | for(i=1;i<v.size();i++)
| ~^~~~~~~~~
roads.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
8 | for(scanf("%lld", &n);i++<n;)
| ~~~~~^~~~~~~~~~~~
roads.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
10 | scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Failed |
1 ms |
204 KB |
Condition failed: "!Cross(S[*pi], S[*pa])" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
304 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
10 ms |
1612 KB |
Output is correct |
5 |
Correct |
19 ms |
2884 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
328 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
2 ms |
444 KB |
Output is correct |
4 |
Correct |
9 ms |
1624 KB |
Output is correct |
5 |
Correct |
17 ms |
2888 KB |
Output is correct |
6 |
Correct |
0 ms |
308 KB |
Output is correct |
7 |
Correct |
1 ms |
304 KB |
Output is correct |
8 |
Correct |
1 ms |
436 KB |
Output is correct |
9 |
Correct |
11 ms |
1624 KB |
Output is correct |
10 |
Correct |
85 ms |
12520 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Correct |
13 ms |
1612 KB |
Output is correct |
5 |
Correct |
19 ms |
2824 KB |
Output is correct |
6 |
Failed |
1 ms |
204 KB |
Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])" |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Failed |
1 ms |
204 KB |
Condition failed: "!Cross(S[*pi], S[*pa])" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Failed |
1 ms |
304 KB |
Condition failed: "!Cross(S[*pi], S[*pa])" |
2 |
Halted |
0 ms |
0 KB |
- |