QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#553557 | #8332. Two in One | Max_FWL | WA | 1ms | 4028kb | C++14 | 1.1kb | 2024-09-08 15:25:29 | 2024-09-08 15:25:30 |
Judging History
answer
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
const int N = 1e5 + 10;
int T, n, ans, c1, c2, a[N], box[N];
vector<int> vec;
pii u[N];
bool CMP(pii x, pii y){
return x.fi > y.fi;
}
void Solve(){
ans = -1;
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = 1; i <= n; i++)
box[i] = 0;
for (int i = 1; i <= n; i++)
box[a[i]]++;
for (int i = 1; i <= n; i++)
u[i] = make_pair(box[i], i);
sort(u + 1, u + n + 1, CMP);
int v = u[1].fi, res = 0;
for (int i = 19; i >= 0; i--){
if (v & (1 << i))
continue;
if (res + (1 << i) <= u[2].fi)
res += (1 << i);
}
cout << (v | res) << endl;
c1 = u[1].se;
c2 = u[2].se;
cout << 1 << " " ;
memset(box, 0, sizeof(box));
for (int i = 1; i <= n; i++){
box[a[i]]++;
if ((box[c1] | box[c2]) == (v | res)){
cout << i << endl;
cout << c1 << " " << c2 << endl;
break;
}
}
}
signed main(){
//freopen("ttheal.in", "r", stdin);
//freopen("ttheal.out", "w", stdout);
cin >> T;
while (T--)
Solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 4028kb
input:
1 7 1 2 3 4 3 2 1
output:
3 1 6 1 2
result:
wrong answer Output contains longer sequence [length = 5], but answer contains 1 elements