Submission details
Task:Counting ones
Sender:aalto26hh_002
Submission time:2026-10-24 12:08:58 +0300
Language:C++ (C++20)
Status:READY
Result:
Test results
testverdicttime
#10.00 sdetails
#20.00 sdetails
#3ACCEPTED0.00 sdetails
#40.00 sdetails
#50.00 sdetails
#60.00 sdetails
#70.06 sdetails
#80.06 sdetails
#90.06 sdetails
#100.06 sdetails

Compiler report

input/code.cpp: In function 'void solve()':
input/code.cpp:58:34: warning: 'maxa' may be used uninitialized [-Wmaybe-uninitialized]
   58 |     cout << max << "\n" << a[maxa] << " " << a[maxb];
      |                                  ^
input/code.cpp:48:17: note: 'maxa' was declared here
   48 |     ll max = 0, maxa, maxb;
      |                 ^~~~
input/code.cpp:58:52: warning: 'maxb' may be used uninitialized [-Wmaybe-uninitialized]
   58 |     cout << max << "\n" << a[maxa] << " " << a[maxb];
      |                                                    ^
input/code.cpp:48:23: note: 'maxb' was declared here
   48 |     ll max = 0, maxa, maxb;
      |                       ^~~~

Code

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

// debug
template<class T> ostream& operator<<(ostream&, const vector<T>&);
template<class T> ostream& operator<<(ostream&, const set<T>&);
template<class T> ostream& operator<<(ostream&, const multiset<T>&);
template<class K, class V> ostream& operator<<(ostream&, const map<K, V>&);
template<class T, size_t N> ostream& operator<<(ostream&, const array<T, N>&);
template<class A, class B> ostream& operator<<(ostream& os, const pair<A, B>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
template<class T>
void print_collection(ostream& os, const T& v) {
    os << "{";
    bool first = true;
    for (const auto& x : v) {
        if (!first) os << ", ";
        first = false;
        os << x;
    }
    os << "}";
}
template<class T> ostream& operator<<(ostream& os, const vector<T>& v) { print_collection(os, v); return os; }
template<class T> ostream& operator<<(ostream& os, const set<T>& v) { print_collection(os, v); return os; }
template<class T> ostream& operator<<(ostream& os, const multiset<T>& v) { print_collection(os, v); return os; }
template<class K, class V> ostream& operator<<(ostream& os, const map<K, V>& v) { print_collection(os, v); return os; }
template<class T, size_t N> ostream& operator<<(ostream& os, const array<T, N>& v) { print_collection(os, v); return os; }
#define dbg(x) cerr << #x << " = " << (x) << '\n'

using ll = long long;
constexpr int INF = 1'000'000'000; // 1e9
constexpr ll LINF = 1'000'000'000'000'000'000LL; // 1e18
constexpr int MOD = 1'000'000'007; // 1e9 + 7

inline ll add(ll a, ll b) { return (a + b) % MOD; }
inline ll sub(ll a, ll b) { return ((a - b) % MOD + MOD) % MOD; }
inline ll mul(ll a, ll b) { return (a * b) % MOD; }


void solve() {
    int N;
    cin >> N;

    vector<ll> a(N);
    for(int i=0;i<N;++i) {
        cin >> a[i];
    }

    ll max = 0, maxa, maxb;
    for(int i = 0; i<N; i++) {
        for(int j = i+1; j<N;j++) {
            if(__builtin_popcount(a[i]*a[j]) > max) {
                maxa=i;
                maxb=j;
            }
        }
    }

    cout << max << "\n" << a[maxa] << " " << a[maxb];
    
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    solve();

    return 0;
}

Test details

Test 1

Verdict:

input
5
42 100 73 94 1 

correct output
9
42 73

user output
0
94 1

Test 2

Verdict:

input
5
44 19 3 94 55 

correct output
8
19 94

user output
0
94 55

Test 3

Verdict: ACCEPTED

input
10
551 71 709 840 291 122 511 570...

correct output
15
893 438

user output
0
893 438

Test 4

Verdict:

input
10
968 901 548 173 973 856 715 61...

correct output
14
715 698

user output
0
698 598

Test 5

Verdict:

input
100
221994 55181 870733 831328 206...

correct output
29
396737 649459

user output
0
546457 608703

Test 6

Verdict:

input
100
892861 947477 331980 209407 82...

correct output
29
825210 578859

user output
0
770881 856289

Test 7

Verdict:

input
10000
76308292 227339075 779918796 3...

correct output
50
978548139 589096701

user output
0
543602367 936924550

Test 8

Verdict:

input
10000
873429404 968540665 239439572 ...

correct output
49
661547021 435157931

user output
0
613227175 499565507

Test 9

Verdict:

input
10000
10374159 364461027 501874596 4...

correct output
50
313852607 889662850

user output
0
41634808 989505675

Test 10

Verdict:

input
10000
771320644 298761159 20751947 4...

correct output
49
516789275 257079921

user output
0
37946077 861986769