| Task: | Counting ones |
| Sender: | aalto26hh_003 |
| Submission time: | 2026-10-28 14:17:58 +0200 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | ACCEPTED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.00 s | details |
| #2 | ACCEPTED | 0.00 s | details |
| #3 | ACCEPTED | 0.00 s | details |
| #4 | ACCEPTED | 0.00 s | details |
| #5 | ACCEPTED | 0.00 s | details |
| #6 | ACCEPTED | 0.00 s | details |
| #7 | ACCEPTED | 0.05 s | details |
| #8 | ACCEPTED | 0.05 s | details |
| #9 | ACCEPTED | 0.05 s | details |
| #10 | ACCEPTED | 0.05 s | details |
Code
#ifdef ONLINE_JUDGE
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#endif
#include "bits/stdc++.h"
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define FOR(i, a, b) for(__typeof(b) i = a, _b = b; i <= _b; ++i)
#define FORD(i, a, b) for(__typeof(a) i = a, _b = b; i >= _b; --i)
#define ALL(a) (a).begin(), (a).end()
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define ll long long
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define ii pair<int,int>
#define iii pair<int,pair<int,int>>
#define dq deque<int>
#define nend '\n'
using namespace std;
const ll inf = 1e18;
const int dx[] = {1,0,-1,0};
const int dy[] = {0,1,0,-1};
const int MOD = 1e9 + 7;
const ll hashi = 2e9 + 11;
void init_code() {
fast;
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
}
const int N=1e4+3;
int n;
unsigned ll a[N];
void solve() {
cin >> n;
FOR(i,1,n) cin >> a[i];
int best=-1; unsigned ll x=0, y=0;
FOR(i,1,n) FOR(j,i+1,n) {
int c=__builtin_popcountll(a[i]*a[j]);
if (c>best) best=c, x=a[i], y=a[j];
}
cout << best << nend << x << ' ' << y << nend;
}
int main() {
init_code();
int t = 1;
// cin >> t;
while (t--) {
solve();
}
return 0;
}
Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 5 42 100 73 94 1 |
| correct output |
|---|
| 9 42 73 |
| user output |
|---|
| 9 42 73 |
Test 2
Verdict: ACCEPTED
| input |
|---|
| 5 44 19 3 94 55 |
| correct output |
|---|
| 8 19 94 |
| user output |
|---|
| 8 19 94 |
Test 3
Verdict: ACCEPTED
| input |
|---|
| 10 551 71 709 840 291 122 511 570... |
| correct output |
|---|
| 15 893 438 |
| user output |
|---|
| 15 893 438 |
Test 4
Verdict: ACCEPTED
| input |
|---|
| 10 968 901 548 173 973 856 715 61... |
| correct output |
|---|
| 14 715 698 |
| user output |
|---|
| 14 715 698 |
Test 5
Verdict: ACCEPTED
| input |
|---|
| 100 221994 55181 870733 831328 206... |
| correct output |
|---|
| 29 396737 649459 |
| user output |
|---|
| 29 396737 649459 |
Test 6
Verdict: ACCEPTED
| input |
|---|
| 100 892861 947477 331980 209407 82... |
| correct output |
|---|
| 29 825210 578859 |
| user output |
|---|
| 29 825210 578859 |
Test 7
Verdict: ACCEPTED
| input |
|---|
| 10000 76308292 227339075 779918796 3... |
| correct output |
|---|
| 50 978548139 589096701 |
| user output |
|---|
| 50 978548139 589096701 |
Test 8
Verdict: ACCEPTED
| input |
|---|
| 10000 873429404 968540665 239439572 ... |
| correct output |
|---|
| 49 661547021 435157931 |
| user output |
|---|
| 49 661547021 435157931 |
Test 9
Verdict: ACCEPTED
| input |
|---|
| 10000 10374159 364461027 501874596 4... |
| correct output |
|---|
| 50 313852607 889662850 |
| user output |
|---|
| 50 313852607 889662850 |
Test 10
Verdict: ACCEPTED
| input |
|---|
| 10000 771320644 298761159 20751947 4... |
| correct output |
|---|
| 49 516789275 257079921 |
| user output |
|---|
| 49 516789275 257079921 |
