/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 73ms 576.0 KiB
#3 Accepted 73ms 564.0 KiB
#4 Accepted 73ms 540.0 KiB
#5 Accepted 73ms 540.0 KiB
#6 Accepted 73ms 564.0 KiB
#7 Accepted 19ms 540.0 KiB
#8 Accepted 22ms 564.0 KiB
#9 Accepted 19ms 796.0 KiB
#10 Accepted 19ms 588.0 KiB
#11 Accepted 20ms 788.0 KiB
#12 Accepted 13ms 1.266 MiB
#13 Accepted 13ms 1.312 MiB
#14 Accepted 48ms 1.32 MiB
#15 Accepted 47ms 1.273 MiB

Code

// Created on: 2025-02-26 12:00
// Author: Safwan_Ibrahim

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl '\n'

const int N = 2e5 + 8;
int A[N];

void Try() {
    int n; cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> A[i];
    }
    
    map<int, int>Mp;
    for (int i = 1; i <= n; i++) {
        for (int j = 2; j <= 1e9; j *= 2) {
            if (Mp.find(j - 1 - A[i]) != Mp.end()) {
                cout << 1 << endl; return;
            }
        }
        Mp[A[i]]++;
    }
    
    cout << 0 << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(0);cin.tie(0);

    int t = 1; cin >> t;
    for (int i = 1; i <= t; i++) {
        Try();
    }
    return 0;
} 

Information

Submit By
Type
Submission
Problem
P1175 Maximum binary product of sum pairs
Contest
Intra LU IEEE Beginner Programming Contest
Language
C++17 (G++ 13.2.0)
Submit At
2025-02-26 06:05:54
Judged At
2025-02-26 06:05:54
Judged By
Score
100
Total Time
73ms
Peak Memory
1.32 MiB