QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#30616#973. Composite SequencePrgl#WA 3ms3740kbC++1.6kb2022-04-30 14:35:322022-04-30 14:35:33

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-04-30 14:35:33]
  • Judged
  • Verdict: WA
  • Time: 3ms
  • Memory: 3740kb
  • [2022-04-30 14:35:32]
  • Submitted

answer

#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using TP = tuple<int, int, int>;
#define all(x) x.begin(),x.end()
#define mk make_pair
//#define int LL
//#define lc p*2
//#define rc p*2+1
#define endl '\n'
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
//#pragma warning(disable : 4996)
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
const double eps = 1e-8;
const LL MOD = 1000000007;
const LL mod = 998244353;
const int maxn = 100010;

int N, A[maxn];

bool isprime(int x)
{
	if (x == 1 || x == 0)
		return true;
	for (int i = 2; i * i <= x; i++)
	{
		if (x % i == 0)
			return false;
	}

	return true;
}

void solve()
{
	if (N == 1)
	{
		if (isprime(A[1]))
			cout << "No" << endl;
		else
			cout << "Yes" << endl;
		return;
	}
	int odd = 0, one = 0, two = 0;
	int onum;
	for (int i = 1; i <= N; i++)
	{
		if (A[i] % 2 == 0 && A[i] != 2)
		{
			cout << "Yes" << endl;
			return;
		}
		if (A[i] % 2)
		{
			odd++;
			onum = A[i];
		}
		if (A[i] == 2)
			two++;
		if (A[i] == 1)
			one++;
	}
	if (odd >= 2 && one < odd)
	{
		cout << "Yes" << endl;
		return;
	}
	if (one > 3)
	{
		cout << "Yes" << endl;
		return;
	}
	if (two >= 2 || two >= 1 && one >= 2)
	{
		cout << "Yes" << endl;
		return;
	}
	if (two == 1 && odd == 1 && !isprime(2 + onum))
	{
		cout << "Yes" << endl;
		return;
	}
	cout << "No" << endl;
}

int main()
{
	IOS;
	cin >> N;
	for (int i = 1; i <= N; i++)
		cin >> A[i];
	solve();

	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 3616kb

input:

2
5 7

output:

Yes

result:

ok "Yes"

Test #2:

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

input:

1
97

output:

No

result:

ok "No"

Test #3:

score: 0
Accepted
time: 3ms
memory: 3612kb

input:

1
97

output:

No

result:

ok "No"

Test #4:

score: 0
Accepted
time: 3ms
memory: 3616kb

input:

3
1 1 1

output:

No

result:

ok "No"

Test #5:

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

input:

4
1 1 1 1

output:

Yes

result:

ok "Yes"

Test #6:

score: 0
Accepted
time: 1ms
memory: 3536kb

input:

5
1 1 1 1 1

output:

Yes

result:

ok "Yes"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

2
1 2

output:

No

result:

ok "No"

Test #8:

score: 0
Accepted
time: 3ms
memory: 3636kb

input:

1
842538847

output:

No

result:

ok "No"

Test #9:

score: 0
Accepted
time: 3ms
memory: 3612kb

input:

1
211843267

output:

No

result:

ok "No"

Test #10:

score: 0
Accepted
time: 3ms
memory: 3684kb

input:

1
398694137

output:

No

result:

ok "No"

Test #11:

score: 0
Accepted
time: 3ms
memory: 3740kb

input:

1
370063921

output:

No

result:

ok "No"

Test #12:

score: 0
Accepted
time: 2ms
memory: 3632kb

input:

1
794328203

output:

No

result:

ok "No"

Test #13:

score: 0
Accepted
time: 3ms
memory: 3664kb

input:

1
4569743

output:

No

result:

ok "No"

Test #14:

score: 0
Accepted
time: 0ms
memory: 3472kb

input:

1
84242507

output:

No

result:

ok "No"

Test #15:

score: 0
Accepted
time: 3ms
memory: 3688kb

input:

1
627620321

output:

No

result:

ok "No"

Test #16:

score: 0
Accepted
time: 3ms
memory: 3588kb

input:

1
112813361

output:

No

result:

ok "No"

Test #17:

score: 0
Accepted
time: 2ms
memory: 3736kb

input:

1
467803799

output:

No

result:

ok "No"

Test #18:

score: 0
Accepted
time: 3ms
memory: 3604kb

input:

2
2 816177959

output:

No

result:

ok "No"

Test #19:

score: 0
Accepted
time: 3ms
memory: 3672kb

input:

2
2 833756321

output:

No

result:

ok "No"

Test #20:

score: 0
Accepted
time: 3ms
memory: 3608kb

input:

2
2 869570201

output:

No

result:

ok "No"

Test #21:

score: 0
Accepted
time: 3ms
memory: 3636kb

input:

2
2 803874569

output:

No

result:

ok "No"

Test #22:

score: 0
Accepted
time: 3ms
memory: 3616kb

input:

2
2 855615191

output:

No

result:

ok "No"

Test #23:

score: 0
Accepted
time: 3ms
memory: 3612kb

input:

2
2 816406499

output:

No

result:

ok "No"

Test #24:

score: -100
Wrong Answer
time: 3ms
memory: 3584kb

input:

2
2 875685741

output:

No

result:

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