#include <bits/stdc++.h>
#define C 1
#define P 0
#define debug(x) cerr << #x << " " << x << "\n"
#define debugs(x) cerr << #x << " " << x << " "
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <long double, pii> muchie;
const ll NMAX = 100001;
const ll VMAX = 101;
const ll INF = (1LL << 60);
const ll MOD = 1000000007;
const ll BLOCK = 447;
const ll base = 117;
const ll nr_of_bits = 18;
const ll inv2 = 500000004;
map <pii, pii> mp;
pii v[NMAX * 2];
struct ura{
pii a, b;
};
vector <ura> sol;
map <pii, bool> scutit;
double slope = 1;
bool mic(pii a, pii b){
pair <double, double> pa = {a.first * cos(slope), a.second * sin(slope)};
pair <double, double> pb = {b.first * cos(slope), b.second * sin(slope)};
return pa < pb;
}
bool cmp(pii a, pii b){
return (mic(a, b));
}
int main() {
//ifstream cin(".in");
//ofstream cout(".out");
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, i;
cin >> n;
for(i = 1; i <= n; i++){
pii a, b;
cin >> a.first >> a.second >> b.first >> b.second;
if(a.first != b.first)
slope = (double)((double)a.second - (double)b.second) / (double)((double)a.first - (double)b.first);
mp[a] = b;
mp[b] = a;
if(mic(a, b))
swap(a, b);
v[i] = a;
}
sort(v + 1, v + n + 1, cmp);
for(i = 1; i < n; i++){
sol.push_back({v[i], mp[v[i + 1]]});
}
for(auto x : sol){
cout << x.a.first << " " << x.a.second << " " << x.b.first << " " << x.b.second << "\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Failed |
76 ms |
6576 KB |
Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])" |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
220 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
17 ms |
2256 KB |
Output is correct |
5 |
Correct |
39 ms |
4004 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
216 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
22 ms |
2156 KB |
Output is correct |
5 |
Correct |
43 ms |
3996 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Failed |
1 ms |
340 KB |
Condition failed: "!Cross(S[*pi], S[*pa])" |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
3 ms |
500 KB |
Output is correct |
4 |
Correct |
19 ms |
2212 KB |
Output is correct |
5 |
Correct |
52 ms |
3972 KB |
Output is correct |
6 |
Failed |
0 ms |
212 KB |
Condition failed: "pf == Sline.end() || !Cross(S[*pa], S[*pf])" |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
468 KB |
Output is correct |
5 |
Correct |
32 ms |
2244 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Failed |
1 ms |
340 KB |
Condition failed: "!Cross(S[*pi], S[*pa])" |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Failed |
104 ms |
6540 KB |
Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])" |
3 |
Halted |
0 ms |
0 KB |
- |