QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#693162#9422. Two-star Contesteden369WA 3ms37348kbC++171.4kb2024-10-31 15:38:472024-10-31 15:39:07

Judging History

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

  • [2024-10-31 15:39:07]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:37348kb
  • [2024-10-31 15:38:47]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+10;
const int INF=1e10;
vector<int> p[N];
int n,m,k,a[N],idx[N],c[N],s[N],ad[N];
bool cmp(int b,int c)
{
    return a[b]<a[c];
}
void solve()
{
    cin>>n>>m>>k;
    for(int i=1;i<=n;++i) p[i]={},idx[i]=i,s[i]=c[i]=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        for(int j=1;j<=m;j++)
        {
            int x;
            cin>>x;
            p[i].push_back(x);
            if(p[i][j]==-1)
            {
                c[i]++;
            }
            else
            {
                s[i]+=p[i][j];
            }
        }
    }
    sort(idx+1,idx+1+n,cmp);
    for(int i=1,x,j,mx=-INF,lst=-INF;i<=n;i=j){
		for(j=i,mx=-INF;j<=n&&a[idx[j]]==a[idx[i]];++j){
			x=idx[j];/*x为j所在的行*/
			ad[x]=min(max(lst+1,s[x]),s[x]+k*c[x]);/*当前行的分数,要么比上一难度分数多1(或者本身就高),(或者全打高分得到的max值判断)*/
			if(ad[x]<=lst) {printf("No\n");return ;}
			mx=max(mx,ad[x]),ad[x]-=s[x];/*更新上限,和未知数的和*/
		}
		lst=mx;
	}
    printf("Yes\n");
	for(int i=1;i<=n;++i){
		for(int j=0;j<m;++j){
			if(p[i][j]==-1) p[i][j]=min(k,ad[i]),ad[i]-=p[i][j];
			printf("%lld ", p[i][j]);
		}
		puts("");
	}
}
signed main()
{
    int t;
    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: 3ms
memory: 37348kb

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:

No
Yes
5 0 8 
10 10 10 
Yes
1 2 3 
4 5 6 
No
Yes
12 0 0 
0 0 0 

result:

wrong answer Participant fails to find an answer while the jury found one. (test case 1)