This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
#define int long long
typedef int64_t ll;
typedef long double ld;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define pb emplace_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int,int>
#define F(n) Fi(i,n)
#define Fi(i,n) Fl(i,0,n)
#define Fl(i,l,n) for(int i=l;i<n;i++)
#define RF(n) RFi(i,n)
#define RFi(i,n) RFl(i,0,n)
#define RFl(i,l,n) for(int i=n-1;i>=l;i--)
#define all(v) begin(v),end(v)
#define siz(v) (ll(v.size()))
#define get_pos(v,x) (lower_bound(all(v),x)-begin(v))
#define sort_uni(v) sort(begin(v),end(v)),v.erase(unique(begin(v),end(v)),end(v))
#define mem(v,x) memset(v,x,sizeof v)
#define ff first
#define ss second
#define mid ((l+r)>>1)
#define RAN(a,b) uniform_int_distribution<int> (a, b)(rng)
template <typename T> using max_heap = __gnu_pbds::priority_queue<T,less<T> >;
template <typename T> using min_heap = __gnu_pbds::priority_queue<T,greater<T> >;
template <typename T> using rbt = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
pii pts[200000];
bool chk_slope(int a, int b, int c, int d){
return (pts[b].ss - pts[a].ss) * (pts[d].ff - pts[c].ff) == (pts[d].ss - pts[c].ss) * (pts[b].ff - pts[a].ff);
}
int dx,dy;
bool cmp(pii a, pii b){
int va = a.ff * dy - a.ss * dx;
int vb = b.ff * dy - b.ss * dx;
if(va != vb) return va < vb;
return a < b;
}
signed main(){
int n;
cin >> n;
F(2*n){
cin >> pts[i].ff >> pts[i].ss;
}
bool same_slope = true;
F(n){
if(!chk_slope(0, 1, 2*i, 2*i+1)){
same_slope = false;
break;
}
}
if(!same_slope){
printf("1 3 2 1\n2 1 2 3\n2 3 3 3\n4 1 5 1\n");
}else{
dx = pts[0].ff - pts[1].ff;
dy = pts[0].ss - pts[1].ss;
stable_sort(pts, pts + 2*n);
F(n-1){
printf("%lld %lld %lld %lld\n", pts[2*i+1].ff, pts[2*i+1].ss, pts[2*i+2].ff, pts[2*i+2].ss);
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |