Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define gc c=getchar()
- #define r(x) read(x)
- #define ll long long
- template<typename T>
- inline void read(T&x){
- x=0;T k=1;char gc;
- while(!isdigit(c)){if(c=='-')k=-1;gc;}
- while(isdigit(c)){x=x*10+c-'0';gc;}x*=k;
- }
- int x[10];
- int y[10];
- int ord[10];
- inline int sqr(int x){
- return x*x;
- }
- inline int l(int a,int b){
- return sqr(x[ord[a]]-x[ord[b]])+sqr(y[ord[a]]-y[ord[b]]);
- }
- int main(){
- // freopen(".in","r",stdin);
- // freopen(".out","w",stdout);
- for(int i=1;i<=8;++i){
- r(x[i]),r(y[i]);
- ord[i]=i;
- }
- do{
- if(l(1,2)==l(2,3) && l(2,3)==l(3,4) && l(3,4)==l(4,1) && l(1,3)==l(2,4) && l(5,6)==l(7,8) && l(5,8)==l(6,7) && l(6,8)==l(5,7)){
- puts("YES");
- for(int i=1;i<=4;++i)printf("%d ",ord[i]);puts("");
- for(int i=5;i<=8;++i)printf("%d ",ord[i]);puts("");
- return 0;
- }
- }while(next_permutation(ord+1,ord+9));
- puts("NO");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement