QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#430048 | #973. Composite Sequence | grass8cow# | WA | 0ms | 3848kb | C++14 | 450b | 2024-06-03 12:09:36 | 2024-06-03 12:09:37 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n,a[300100];
#define ll long long
bool chk(ll x){
if(x==1)return 0;
for(ll i=2;i*i<=x;i++)if(!(x%i))return 0;
return 1;
}
int main(){
scanf("%d",&n);
if(n>=6){puts("No");return 0;}
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
int h=0;
for(int s=0;s<(1<<n);s++){
ll z=0;
for(int i=0;i<n;i++)if((s>>i)&1)z+=a[i+1];
if(!chk(z))h++;
}
puts((h==1)?"Yes":"No");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3844kb
input:
2 5 7
output:
Yes
result:
ok "Yes"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
1 97
output:
No
result:
ok "No"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
1 97
output:
No
result:
ok "No"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
3 1 1 1
output:
No
result:
ok "No"
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3804kb
input:
4 1 1 1 1
output:
No
result:
wrong answer 1st words differ - expected: 'Yes', found: 'No'