fork download
  1. // To understand what is happening in this file, please go to the end of the file.
  2.  
  3. #include "bits/stdc++.h"
  4.  
  5. #define int long long
  6. #define vi vector< int >
  7. #define fastIO() ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
  8. #define all(x) x.begin(),x.end()
  9. #define endl '\n'
  10.  
  11. using namespace std;
  12.  
  13. /*
  14.  
  15.  
  16.   ▄████ ██▓ ██▓▄▄▄█████▓ ▄████▄ ██░ ██
  17.  ██▒ ▀█▒▓██▒ ▓██▒▓ ██▒ ▓▒▒██▀ ▀█ ▓██░ ██▒
  18. ▒██░▄▄▄░▒██░ ▒██▒▒ ▓██░ ▒░▒▓█ ▄ ▒██▀▀██░
  19. ░▓█ ██▓▒██░ ░██░░ ▓██▓ ░ ▒▓▓▄ ▄██▒░▓█ ░██
  20. ░▒▓███▀▒░██████▒░██░ ▒██▒ ░ ▒ ▓███▀ ░░▓█▒░██▓
  21.  ░▒ ▒ ░ ▒░▓ ░░▓ ▒ ░░ ░ ░▒ ▒ ░ ▒ ░░▒░▒
  22.   ░ ░ ░ ░ ▒ ░ ▒ ░ ░ ░ ▒ ▒ ░▒░ ░
  23. ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░░ ░
  24.   ░ ░ ░ ░ ░ ░ ░ ░ ░
  25.  
  26. */
  27.  
  28. template<typename typC> istream &operator>>(istream &cin,vector<typC> &a) { for (auto &x:a) cin>>x; return cin; }
  29. template<typename typC> ostream &operator<<(ostream &cout,const vector<typC> &a) { int n=a.size(); if (!n) return cout; cout<<a[0]; for (int i=1; i<n; i++) cout<<' '<<a[i]; return cout; }
  30.  
  31. int dx [] = {0, 0, 1, -1};
  32. int dy [] = {1, -1, 0, 0};
  33.  
  34.  
  35. int dis(int x1, int y1, int x2, int y2){
  36. return (x1-x2) * (x1-x2) + (y1-y2) * (y1-y2);
  37. }
  38.  
  39. bool check(int a, int b, int c){
  40. if(a == 0 || b == 0 || c == 0) return false;
  41. vi v = {a, b, c};
  42. sort(all(v));
  43. return v[0] + v[1] == v[2];
  44. }
  45.  
  46. void itIsADream(){
  47. int x1, y1, x2, y2, x3, y3; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
  48.  
  49. int a = dis(x1, y1, x2, y2);
  50. int b = dis(x1, y1, x3, y3);
  51. int c = dis(x2, y2, x3, y3);
  52.  
  53. if(check(a, b, c)) {
  54. cout << "RIGHT\n";
  55. return;
  56. }
  57.  
  58. for(int i = 0; i < 4; i++){
  59. int newX = x1 + dx[i];
  60. int newY = y1 + dy[i];
  61. a = dis(newX, newY, x2, y2);
  62. b = dis(newX, newY, x3, y3);
  63. c = dis(x2, y2, x3, y3);
  64. if(check(a, b, c)) {
  65. cout << "ALMOST\n";
  66. return;
  67. }
  68. }
  69.  
  70. for(int i = 0; i < 4; i++){
  71. int newX = x2 + dx[i];
  72. int newY = y2 + dy[i];
  73. a = dis(x1, y1, newX, newY);
  74. b = dis(x1, y1, x3, y3);
  75. c = dis(newX, newY, x3, y3);
  76. if(check(a, b, c)) {
  77. cout << "ALMOST\n";
  78. return;
  79. }
  80. }
  81.  
  82. for(int i = 0; i < 4; i++){
  83. int newX = x3 + dx[i];
  84. int newY = y3 + dy[i];
  85. a = dis(x1, y1, x2, y2);
  86. b = dis(x1, y1, newX, newY);
  87. c = dis(x2, y2, newX, newY);
  88. if(check(a, b, c)) {
  89. cout << "ALMOST\n";
  90. return;
  91. }
  92. }
  93.  
  94. cout << "NEITHER\n";
  95. }
  96.  
  97. int32_t main()
  98. {
  99. fastIO();
  100. // freopen("input.txt", "r", stdin);
  101. // freopen("output.txt", "w", stdout);
  102. int t = 1;
  103. // cin >> t;
  104. while (t--)
  105. {
  106. itIsADream();
  107. }
  108. return 0;
  109. }
  110.  
  111. // to understand what is happening in this file, please go to the starting of the file.
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
RIGHT