/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Wrong Answer 601ms 588.0 KiB
#3 Accepted 573ms 576.0 KiB
#4 Accepted 545ms 576.0 KiB
#5 Accepted 546ms 584.0 KiB
#6 Accepted 541ms 584.0 KiB
#7 Accepted 54ms 724.0 KiB
#8 Accepted 84ms 544.0 KiB
#9 Accepted 55ms 540.0 KiB
#10 Accepted 60ms 552.0 KiB
#11 Accepted 54ms 540.0 KiB
#12 Accepted 35ms 1.82 MiB
#13 Accepted 35ms 2.027 MiB
#14 Accepted 80ms 2.059 MiB
#15 Accepted 75ms 2.027 MiB

Code

#include<bits/stdc++.h>
using namespace std;
#define int             long long
#define pb              push_back
#define endl            '\n'
#define pp              pair<int,pair<int,int>>
#define asort(a,n)      sort(a,a+n) 
#define arrout(a,n)     for(int i=1;i<=n;i++)cout<<a[i]<<" ";
#define vcout(v)        for(auto i:v)cout<<i<<" ";
#define vsort(v)        sort(v.begin(),v.end())
#define vrsort(v)       sort(v.rbegin(),v.rend());
#define YES             cout<<"YES"<<endl
#define NO              cout<<"NO"<<endl
#define yes             cout<<"yes"<<endl
#define no              cout<<"no"<<endl
#define Yes             cout<<"Yes"<<endl
#define No              cout<<"No"<<endl
#define pqr             priority_queue<int,vector<int>,greater<int>>
#define debug           cout<<"HERE"<<endl;
void edm()
{
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}
int pwr(int a,int b)
{
    int ans=1;
    while(b>0)
    {
        if(b%2!=0)ans=(ans*a);
        a = (a*a);
        b>>=1;
    }
    return ans;
}
void solve()
{
    int n;cin>>n;
    map<int,int>mp;
    int arr[n];
    int ans=0;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        mp[arr[i]]++;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<18;j++)
        {
            int val = pwr(2,j) - 1;
            int more = val - arr[i];
            if(mp[more])
            {
                // cout<<arr[i]<<" "<<more<<endl;
                cout<<1<<endl;
                return;
            }
        }
    }
    cout<<0<<endl;
}
int32_t main()
{
    //edm();
    int t = 1;
    cin >> t;
    for(int i=1;i<=t;i++)
    {
        //cout<<"Case "<<i<<": "<<endl;
        solve();
    }
}

Information

Submit By
Type
Submission
Problem
P1175 Maximum binary product of sum pairs
Language
C++17 (G++ 13.2.0)
Submit At
2025-04-21 19:44:56
Judged At
2025-04-21 19:44:56
Judged By
Score
95
Total Time
601ms
Peak Memory
2.059 MiB