QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#404146#6317. XOR Tree Pathcomeintocalm#WA 1ms3736kbC++20873b2024-05-03 13:45:592024-05-03 13:46:00

Judging History

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

  • [2024-05-03 13:46:00]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3736kb
  • [2024-05-03 13:45:59]
  • 提交

answer

#include <bits/stdc++.h>
#define LL long long
#define db double
using namespace std;

const int MAXN = 1e5 + 5, N = 9999;
int n, m;
int f[105][N + 5];

vector<int> vec[N + 5];

int cnt[N + 5];
int p[10], mp[10];
int main() {
	int i,j,k;
	int x, y, z;
	cin >> n >> m;
	for (i = 0; i <= n; ++i)
		for (j = 0; j <= N; ++j)
			f[i][j] = -1e9;
	for (i = 0; i <= N; ++i) {
	}
	
	for (k = 0; k < vec[m].size(); ++k)
		f[0][ vec[m][k] ] = 0;
	for (i = 1; i <= n; ++i) {
		cin >> x;
		for (j = x; j <= N; ++j)
			f[i][j - x] = max (f[i][j - x], f[i - 1][j] + 1);
		for (j = 0; j <= N; ++j)
			f[i][j] = max (f[i][j], f[i - 1][j]);
		for (j = 0; j <= N; ++j)
			for (k = 0; k < vec[j].size(); ++k)
				f[i][j] = max (f[i][j], f[i][ vec[j][k] ]);
	}
	int ans = 0;
	for (i = 0; i <= N; ++i)
		ans = max (ans, f[n][i]);
	cout << ans;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3736kb

input:

5
1 0 0 1 0
1 2
1 3
3 4
3 5

output:

0

result:

wrong answer 1st numbers differ - expected: '5', found: '0'