fork download
  1. #include<stdio.h>
  2. #include<math.h>
  3.  
  4. int main()
  5. {
  6. int cas;
  7. int pair;
  8. scanf("%d",&cas);
  9. while(cas--)
  10. {
  11. scanf("%d",&pair);
  12. int P[pair+1][pair+1];
  13. //while(pair--)
  14. for (int i=0;i<pair;i++)
  15. {
  16. scanf("%d %d",&P[i][0],&P[i][1]);
  17. //printf("%d %d\n",P[i][0],P[i][1]);
  18. }
  19. int have = 0;
  20. for(int i=-10000000;i<=10000000;i++)
  21. {
  22. for(int j=-10000000;j<=0000000;j++)
  23. {
  24. int disA[pair];
  25. for(int k=0;k<pair;k++)
  26. {
  27. int dis = sqrt((P[k][0]-i)*(P[k][0]-i) + (P[k][1]-j)*(P[k][1]-j));
  28. disA[k] = dis;
  29. }
  30. int half = pair/2 ;
  31. int count = 0;
  32. // repeat
  33. for(int m=0;m<pair;m++)
  34. {
  35. //int flag = 0;
  36. //int count = 0;
  37. for(int n=m+1;n<pair;n++)
  38. {
  39. if(disA[m]==disA[n])
  40. {
  41. //flag = 1;
  42. count++;
  43. }
  44. }
  45.  
  46. }
  47. if(count==half)
  48. {
  49. //printf("yes\n");
  50. have = 1;
  51. }
  52. //else
  53. {
  54. //printf("no\n");
  55. }
  56. }
  57. }
  58. if(have==0)
  59. {
  60. printf("no\n");
  61. }
  62. else
  63. {
  64. printf("yes\n");
  65. }
  66. }
  67. return 0;
  68. }
Time limit exceeded #stdin #stdout 5s 9424KB
stdin
1
8
1  10
3  6
6  8
6  2
3  -4
1  0
-2  -2
-2  4
stdout
Standard output is empty