QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#596258#1830. ANDwjy2020RE 0ms0kbC++14961b2024-09-28 15:25:182024-09-28 15:25:18

Judging History

你现在查看的是最新测评结果

  • [2024-09-28 15:25:18]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-09-28 15:25:18]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
// #define int long long
#define sfor(i,j,k) for(register int i=j;i<=k;++i)
#define dfor(i,j,k) for(register int i=k;i>=j;--i)
inline int read(){
    register int x = 0, t = 1;
    register char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')
            t=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*t;
}
inline void write(int x)
{
    if(x<0){
    	putchar('-');
		x=-x;
	}
    if(x>9)
		write(x/10);
    putchar(x%10+'0');
}
int f[1200005];
int main()
{
	
freopen("standard.in","r",stdin);
freopen("standard.out","w",stdout);
int T=read();
while(T--)
  {
int n=read();
sfor(i,1,n) f[i]=read();
sort(f+1,f+1+n);
bool p=0;
sfor(i,2,n)
  if((f[i]&f[1])!=f[1])
    {cout<<-1<<endl;p=1;break;}
if(p) continue;
sfor(i,1,n) cout<<f[1]<<" "<<f[i]<<" ";
cout<<endl;
}}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Dangerous Syscalls

input:

3
1
5
3
0 1 2
2
1 2

output:


result: