QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#26112 | #1830. AND | Sorting# | WA | 2ms | 3500kb | C++20 | 888b | 2022-04-06 16:06:59 | 2022-04-29 02:57:30 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> void check_min(T &a, const T &b){ a = (a < b) ? a : b; }
template<class T> void check_max(T &a, const T &b){ a = (a > b) ? a : b; }
#define all(x) (x).begin(), (x).end()
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while(t--){
int n;
cin >> n;
vector<int> b(n);
for(int &x: b)
cin >> x;
sort(all(b));
bool ok = true;
for(int i = 1; i < n; ++i)
if((b[i] & b[0]) != b[0])
ok = false;
if(!ok){
cout << -1 << "\n";
continue;
}
cout << b[0] << " ";
for(int i = 1; i < n; ++i)
cout << b[i] << " " << b[0] << " ";
cout << "\n";
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3500kb
input:
3 1 5 3 0 1 2 2 1 2
output:
5 0 1 0 2 0 -1
result:
wrong answer set of ands are not equal (test case 1)