QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#643820 | #9422. Two-star Contest | curtain_cpp | WA | 0ms | 3780kb | C++23 | 1.4kb | 2024-10-16 01:31:18 | 2024-10-16 01:31:18 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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)