/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 86ms 532.0 KiB
#3 Accepted 93ms 568.0 KiB
#4 Accepted 111ms 588.0 KiB
#5 Accepted 87ms 532.0 KiB
#6 Accepted 87ms 532.0 KiB
#7 Accepted 24ms 568.0 KiB
#8 Accepted 24ms 572.0 KiB
#9 Accepted 27ms 564.0 KiB
#10 Accepted 24ms 572.0 KiB
#11 Accepted 44ms 532.0 KiB
#12 Accepted 17ms 1.27 MiB
#13 Accepted 17ms 1.27 MiB
#14 Accepted 49ms 1.254 MiB
#15 Accepted 38ms 1.27 MiB

Code

/**
 Author : Kamonasish Roy (Bullet)
 Time : 2025-02-25 13:03:09
 **/

#include<bits/stdc++.h>
using namespace std;
const long long M=5e5,MOD=1e9+7;
typedef long long ll;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    cin>>t;
    assert(t>=1 && t<=10000);
    int sumofn=0;
    while(t--){
    	int n;
    	cin>>n;
    	assert(n> 1 && n<=200000);
    	int f=0;
    	map<int,int>mp;
    	vector<int>arr(n+1);
    	for(int i=1;i<=n;i++){
    		int a;
    		cin>>a;
    		assert(a >= 1&& a<=1e8);
    		mp[a]++;
    		arr[i]=a;
    	}
    	int cur=4;
    	while(cur<=2e8 && !f){
    		int bit=cur-1;// we need to check 2^i - 1. if sum is availbale then possible 1.
    		for(int i=1;i<=n;i++){
    			int rem=bit-arr[i];
    			if(mp.count(rem)){
    				f=1;
    				break;
    			}
    		}
    		cur*=2;
    	}
    	sumofn+=n;
    	assert(sumofn>1 && sumofn<=2e5);
    	cout<<f<<"\n";
    	
    	
    	
    	}
    	
    	   
    return 0;
 
}

Information

Submit By
Type
Submission
Problem
P1175 Maximum binary product of sum pairs
Contest
Lu IEEE testing round
Language
C++17 (G++ 13.2.0)
Submit At
2025-02-25 07:51:28
Judged At
2025-02-25 07:51:28
Judged By
Score
100
Total Time
111ms
Peak Memory
1.27 MiB