QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#76520#5475. Make a LoopXKErrorWA 2ms5492kbC++768b2023-02-10 10:49:202023-02-10 10:49:21

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-10 10:49:21]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:5492kb
  • [2023-02-10 10:49:20]
  • 提交

answer

#include <bits/stdc++.h>

#define maxn 105
#define maxm maxn * 10005
//#define maxm 10

using namespace std;

int n;
int f[2][maxm];
int g[2][maxm];
void $(int &a, int b) {
	a = min(2, a + b);
}

int main() {
	scanf("%d", &n);
	int m = 0;
	f[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		int r;
		scanf("%d", &r);
		m += r;
		for (int j = 0; j <= m; j++) {
			if (j >= r) $(g[0][j], f[1][j - r]);
			if (j + r <= m) $(g[0][j], f[0][j + r]);
			
			if (j >= r) $(g[1][j], f[0][j - r]);
			if (j + r <= m) $(g[1][j], f[1][j + r]);
		}
		for (int j = 0; j <= m; j++) {
			f[0][j] = g[0][j];
			f[1][j] = g[1][j];
			g[0][j] = g[1][j] = 0;
//			cout<<f[0][j]<<" "
		}
	}
	if (f[0][0] == 2) puts("Yes");
	else puts("No");
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 5424kb

input:

4
1 1 1 1

output:

Yes

result:

ok single line: 'Yes'

Test #2:

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

input:

6
1 3 1 3 1 3

output:

No

result:

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