QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#623739#9422. Two-star ContestIdtwtei#WA 0ms22396kbC++141.1kb2024-10-09 13:53:092024-10-09 13:53:11

Judging History

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

  • [2024-10-09 13:53:11]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:22396kb
  • [2024-10-09 13:53:09]
  • 提交

answer

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

#define int long long
#define pb push_back
const int N=4e5+100,INF=1e18;
#define gc getchar()
#define rd read()
inline int read(){
	int x=0,f=0; char c=gc;
	for(;c<'0'||c>'9';c=gc) f|=(c=='-');
	for(;c>='0'&&c<='9';c=gc) x=(x<<1)+(x<<3)+(c^48);
	return f?-x:x;
}

int n,m,k,a[N],idx[N],c[N],s[N],ad[N];
vector<int> p[N];

void solve(){
	n=rd,m=rd,k=rd;
	for(int i=1;i<=n;++i) p[i]={},s[i]=c[i]=0;
	for(int i=1;i<=n;++i) for(int j=0,x;j<m;++j) p[i].pb(x=rd),s[i]+=(x!=-1?x:0),c[i]+=(x==-1);
	for(int i=1;i<=n;++i) a[i]=rd,idx[i]=i;
	sort(idx+1,idx+n+1,[&](int x,int y){ return a[x]<a[y]; });
	for(int i=1,x,lst=-INF;i<=n;++i){
		x=idx[i];
		ad[x]=min(max(lst+1,s[x]),s[x]+k*c[x]);
		if(ad[x]<=lst) return printf("No\n"),void();
		lst=ad[x],ad[x]-=s[x];
	}
	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=rd;
	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: 22396kb

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
5 1 3 0 
3 2 0 5 
0 5 3 3 
No
Yes
10 1 2 
3 100 4 
No
Yes
100 0 0 
100 1 0 

result:

wrong answer Participant has modified p_{0, 0}. Expecting 1 but found 5. (test case 1)