QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#643820#9422. Two-star Contestcurtain_cppWA 0ms3780kbC++231.4kb2024-10-16 01:31:182024-10-16 01:31:18

Judging History

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

  • [2024-10-16 01:31:18]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3780kb
  • [2024-10-16 01:31:18]
  • 提交

answer

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

struct contest {
	int id, star, sum, blank;
	vector<int> prop;
};


void solve()
{
	int n, m, bound;
	cin >> n >> m >> bound;
	vector<contest> a(n);
	for(int i = 0; i < n; ++i) {
		a[i].id = i;
		cin >> a[i].star;
		for(int j = 0; j < m; ++j) {
			int p;
			cin >> p;
			a[i].prop.emplace_back(p);
			if(p != -1) {
				a[i].sum += p;
			} else {
				++a[i].blank;
			}
		}
	}
	sort(a.begin(), a.end(), [](const contest &x, const contest &y) {
		return x.star < y.star;
	});
	int last = -1, cur = -1;
	for(int i = 0; i < n; ++i) {
		int add = max(0ll, last + 1 - a[i].sum);
		if(add > bound * a[i].blank) {
			cout << "No\n";
			return ;
		}
		a[i].sum += add;

		for(int j = 0; j < m; ++j) {
			if(a[i].prop[j] == -1) {
				a[i].prop[j] = min(bound, add);
				add = max(0ll, add - bound);
			}
		}

		//cur = max(cur, a[i].sum);
		if(i + 1 < n && a[i + 1].star != a[i].star) {
			last = cur;
			//cur = -1;
		}
	}
	cout << "Yes\n";
	sort(a.begin(), a.end(), [](const contest &x, const contest &y) {
		return x.id < y.id;
	});
	for(int i = 0; i < n; ++i)
		for(int j = 0; j < m; ++j)
			cout << a[i].prop[j] << " \n"[j == m - 1];

}

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int T = 1;
	cin >> T;
	while(T--) solve();
	return 0;
}

详细

Test #1:

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

input:

5
3 4 5
5 1 3 -1 -1
2 -1 5 -1 5
3 3 -1 -1 4
2 3 10
10000 5 0 -1
1 10 10 10
2 3 10
10 1 2 3
100 4 5 6
2 3 10
100 1 2 3
10 4 5 6
2 3 10000
100 -1 -1 -1
1 -1 -1 -1

output:

Yes
1 3 0 0
0 5 0 5
3 0 0 4
Yes
5 0 0
10 10 10
Yes
1 2 3
4 5 6
Yes
1 2 3
4 5 6
Yes
0 0 0
0 0 0

result:

wrong answer Participant cannot satisfy the constraint. (test case 1)