Facebook
From Tanjid, 4 Months ago, written in C++.
Embed
Download Paste or View Raw
Hits: 221
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define Tanjid ios_base::sync_with_stdio(false);
  5. #define the cin.tie(0);
  6. #define OwL cout.tie(0);
  7. #define endl "n"
  8. #define ll long long
  9.  
  10. void solve() {
  11.     ll n;
  12.     cin >> n;
  13.  
  14.     vector<ll> arr(n);
  15.  
  16.     for (int i = 0; i < n; ++i) {
  17.         cin >> arr[i];
  18.     }
  19.  
  20.  
  21.  
  22.     for (int i = 0; i < n - 3; i++) {
  23.         for (int j = i + 1; j < n - 2; j++) {
  24.             for (int k = j + 1; k < n - 1; k++) {
  25.                 for (int l = k + 1; l < n; l++) {
  26.                     if ((arr[i] + arr[j]) != (arr[k] + arr[l])) {
  27.                         cout << "YES" << endl;
  28.                         return;
  29.                     }
  30.                 }
  31.             }
  32.         }
  33.     }
  34.  
  35.     cout << "NO" << endl;
  36. }
  37.  
  38. int main() {
  39.     Tanjid
  40.     the
  41.     OwL
  42.     int T;
  43.     cin >> T;
  44.  
  45.     while (T--) {
  46.         solve();
  47.     }
  48.  
  49.     return 0;
  50. }
  51.