| Task: | Counting ones |
| Sender: | aalto26hh_021 |
| Submission time: | 2026-10-22 12:50:16 +0300 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | details |
| #2 | WRONG ANSWER | 0.00 s | details |
| #3 | WRONG ANSWER | 0.00 s | details |
| #4 | WRONG ANSWER | 0.00 s | details |
| #5 | WRONG ANSWER | 0.00 s | details |
| #6 | WRONG ANSWER | 0.00 s | details |
| #7 | WRONG ANSWER | 0.26 s | details |
| #8 | WRONG ANSWER | 0.26 s | details |
| #9 | WRONG ANSWER | 0.26 s | details |
| #10 | WRONG ANSWER | 0.26 s | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:27:7: warning: 'max' may be used uninitialized [-Wmaybe-uninitialized]
27 | if(ones > max){
| ^~
input/code.cpp:22:6: note: 'max' was declared here
22 | ll max, n1, n2;
| ^~~
In file included from /usr/include/c++/13/iostream:41,
from input/code.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
inlined from 'int main()' at input/code.cpp:35:11:
/usr/include/c++/13/ostream:204:25: warning: 'n1' may be used uninitialized [-Wmaybe-uninitialized]
204 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
input/code.cpp: In function 'int main()':
input/code.cpp:22:11: note: 'n1' was declared here
22 | ll max, n1, n2;
| ^~
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_ty...Code
#include <iostream>
#include <vector>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vll a(n);
for(auto& x : a) cin >> x;
ll max, n1, n2;
for(int i = 0; i < n; i++){
for(int j = i+1; j < n; j++){
ll ones = __builtin_popcountll(a[i] * a[j]);
if(ones > max){
max = ones;
n1 = a[i];
n2 = a[j];
}
}
}
cout << max << "\n";
cout << n1 << " " << n2 << "\n";
}Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 5 42 100 73 94 1 |
| correct output |
|---|
| 9 42 73 |
| user output |
|---|
| 140737488350464 4607 -104 |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 5 44 19 3 94 55 |
| correct output |
|---|
| 8 19 94 |
| user output |
|---|
| 140737488350464 4607 -104 |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 10 551 71 709 840 291 122 511 570... |
| correct output |
|---|
| 15 893 438 |
| user output |
|---|
| 140737488350464 4607 -104 |
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 10 968 901 548 173 973 856 715 61... |
| correct output |
|---|
| 14 715 698 |
| user output |
|---|
| 140737488350464 4607 -104 |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 100 221994 55181 870733 831328 206... |
| correct output |
|---|
| 29 396737 649459 |
| user output |
|---|
| 140737488350464 4607 -104 |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 100 892861 947477 331980 209407 82... |
| correct output |
|---|
| 29 825210 578859 |
| user output |
|---|
| 140737488350464 4607 -104 |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 10000 76308292 227339075 779918796 3... |
| correct output |
|---|
| 50 978548139 589096701 |
| user output |
|---|
| 140737488350464 4607 -104 |
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 10000 873429404 968540665 239439572 ... |
| correct output |
|---|
| 49 661547021 435157931 |
| user output |
|---|
| 140737488350464 4607 -104 |
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| 10000 10374159 364461027 501874596 4... |
| correct output |
|---|
| 50 313852607 889662850 |
| user output |
|---|
| 140737488350464 4607 -104 |
Test 10
Verdict: WRONG ANSWER
| input |
|---|
| 10000 771320644 298761159 20751947 4... |
| correct output |
|---|
| 49 516789275 257079921 |
| user output |
|---|
| 140737488350464 4607 -104 |
