Advertisement
yuawn

algo2017_week11_sequence

Dec 17th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define fo(n) for(int i=0;i<n;i++)
  4. #define fos(o,n) for(int i=o;i<=n;i++)
  5.  
  6. int main(){
  7.    
  8.     int T;
  9.    
  10.     cin >> T;
  11.  
  12.     while( T-- ){
  13.         int n , x[0x70];
  14.         map<int,bool> mp;
  15.         bool p = 0;
  16.        
  17.         cin >> n;
  18.        
  19.         fo( n ) cin >> x[i] , mp[x[i]] = 1;
  20.        
  21.         fo( n )
  22.             for( int j = i + 1 ; j < n ; ++j )
  23.                 if( mp[x[i] + x[j]] ) p = 1;
  24.                
  25.         if( p ) puts( "false" );
  26.         else puts( "true" );
  27.        
  28.     }
  29.  
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement