| Task: | Counting ones |
| Sender: | aalto26hh_001 |
| Submission time: | 2026-10-25 23:43:15 +0200 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | WRONG ANSWER |
| 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 | WRONG ANSWER | 0.00 s | details |
| #7 | WRONG ANSWER | 1.00 s | details |
| #8 | WRONG ANSWER | 0.99 s | details |
| #9 | WRONG ANSWER | 1.00 s | details |
| #10 | WRONG ANSWER | 0.99 s | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:28:33: warning: 'h' may be used uninitialized [-Wmaybe-uninitialized]
28 | cout << max << endl << h << ' ' << k;
| ^~~
input/code.cpp:11:9: note: 'h' was declared here
11 | int h, k;
| ^
input/code.cpp:28:40: warning: 'k' may be used uninitialized [-Wmaybe-uninitialized]
28 | cout << max << endl << h << ' ' << k;
| ^
input/code.cpp:11:12: note: 'k' was declared here
11 | int h, k;
| ^Code
#include <bits/stdc++.h>
using namespace std;
int main() {
//std::ios_base::sync_with_stdio(0);
int n;
cin >> n;
vector<int> v(n);
for (int& t : v) cin >> t;
sort(v.begin(), v.end());
int h, k;
int currMax = 0, max = -67;
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
int t = v[i] * v[j];
while (t > 0) {
if (t % 2 > 0) currMax++;
t /= 2;
}
if (currMax > max) {
max = currMax;
h = v[i];
k = v[j];
}
currMax = 0;
}
}
cout << max << endl << h << ' ' << k;
}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 438 893 |
Test 4
Verdict: ACCEPTED
| input |
|---|
| 10 968 901 548 173 973 856 715 61... |
| correct output |
|---|
| 14 715 698 |
| user output |
|---|
| 14 698 715 |
Test 5
Verdict: ACCEPTED
| input |
|---|
| 100 221994 55181 870733 831328 206... |
| correct output |
|---|
| 29 396737 649459 |
| user output |
|---|
| 28 14581 368163 |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 100 892861 947477 331980 209407 82... |
| correct output |
|---|
| 29 825210 578859 |
| user output |
|---|
| 23 59579 746511 |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 10000 76308292 227339075 779918796 3... |
| correct output |
|---|
| 50 978548139 589096701 |
| user output |
|---|
| 29 97551207 676435881 |
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 10000 873429404 968540665 239439572 ... |
| correct output |
|---|
| 49 661547021 435157931 |
| user output |
|---|
| 30 612237185 701341503 |
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| 10000 10374159 364461027 501874596 4... |
| correct output |
|---|
| 50 313852607 889662850 |
| user output |
|---|
| 28 35008313 43512467 |
Test 10
Verdict: WRONG ANSWER
| input |
|---|
| 10000 771320644 298761159 20751947 4... |
| correct output |
|---|
| 49 516789275 257079921 |
| user output |
|---|
| 29 191260279 338576285 |
