QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#513477#8813. Records in Chichén ItzáPetroTarnavskyi#WA 0ms3780kbC++201.0kb2024-08-10 17:59:052024-08-10 17:59:09

Judging History

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

  • [2024-08-10 17:59:09]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3780kb
  • [2024-08-10 17:59:05]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

void solve()
{
	int n, m, k, s;
	cin >> n >> m >> k >> s;
	vector<tuple<int, int, int>> v(m);
	FOR (i, 0, m)
	{
		int a, b, c;
		cin >> a >> b >> c;
		v[i] = {a, b, c};
	}
	FOR (i, 0, k)
	{
		int c;
		cin >> c;
		int a = 0, b = 0;
		v.PB({a, b, c});
	}
	int ans = 0;
	sort(ALL(v));
	do
	{
		int res = 0;
		int t = s;
		for (auto [a, b, c] : v)
		{
			if (t == a)
				res += b;
			t = c;
		}
		ans = max(ans, res);
	} while(next_permutation(ALL(v)));
	cout << ans << '\n';
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int t;
	cin >> t;
	while (t--)
	{
		solve();
	}
	
	return 0;
}


详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3780kb

input:

3
6
1 1 1 1 3 3
5
1 1 2 2 2
10
1 1 1 1 2 2 2 2 3 3

output:

3
10
3

result:

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