QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#46811#973. Composite SequenceUfowoqqqoWA 2ms3744kbC++753b2022-09-01 23:00:012022-09-01 23:00:04

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-01 23:00:04]
  • Judged
  • Verdict: WA
  • Time: 2ms
  • Memory: 3744kb
  • [2022-09-01 23:00:01]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 100010;

ll a[N];

bool check(ll x)
{
    ll i;

    for(i = 2; i * i <= x; i ++)
        if(x % i == 0)
            return false;

    return true;
}

int main()
{
    int n;
    int i, j;
    ll sum;

    scanf("%d", &n);
    for(i = 0; i < n; i ++)
        scanf("%lld", &a[i]);

    if(n > 3)
    {
        puts("Yes");
        return 0;
    }

    for(i = 1; i < (1 << n); i ++)
    {
        for(j = sum = 0; j < n; j ++)
            if(i & (1 << j))
                sum += a[j];
        if(!check(sum))
        {
            puts("Yes");
            return 0;
        }
    }

    puts("NO");

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3652kb

input:

2
5 7

output:

Yes

result:

ok "Yes"

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 3744kb

input:

1
97

output:

NO

result:

wrong answer 1st words differ - expected: 'No', found: 'NO'