QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#623739 | #9422. Two-star Contest | Idtwtei# | WA | 0ms | 22396kb | C++14 | 1.1kb | 2024-10-09 13:53:09 | 2024-10-09 13:53:11 |
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) 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)