QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#623775 | #9422. Two-star Contest | Vamilio | WA | 21ms | 22568kb | C++14 | 1.1kb | 2024-10-09 13:57:22 | 2024-10-09 13:57:26 |
Judging History
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){ a[i]=rd; 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) 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: 100
Accepted
time: 5ms
memory: 21864kb
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 5 3 0 5 0 5 3 4 0 4 No Yes 1 2 3 4 5 6 No Yes 1 0 0 0 0 0
result:
ok ok 5 cases (5 test cases)
Test #2:
score: -100
Wrong Answer
time: 21ms
memory: 22568kb
input:
1013 3 2 1 1 -1 -1 2 0 1 3 -1 -1 4 8 96295 302790137 -1 849 -1 -1 33907 7926 9461 70117 695984050 -1 -1 56792 -1 -1 -1 19527 -1 302790137 12828 30553 40825 67577 91517 77952 55631 63781 302790137 29385 -1 -1 -1 750 -1 -1 -1 2 6 72716304 892657961 -1 -1 66436933 -1 45419040 55642613 892657961 -1 6271...
output:
Yes 0 0 0 1 1 1 Yes 0 849 0 0 33907 7926 9461 70117 96295 96295 56792 96295 75462 0 19527 0 12828 30553 40825 67577 91517 77952 55631 63781 29385 96295 96295 96295 750 96295 25350 0 Yes 0 0 66436933 0 45419040 55642613 14090348 62712753 0 21765515 56544945 12385026 Yes 975402536 975402536 9...
result:
wrong answer Participant fails to find an answer while the jury found one. (test case 11)