QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#720834#9422. Two-star ContestAlasco#WA 24ms27880kbC++141.7kb2024-11-07 14:21:082024-11-07 14:21:09

Judging History

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

  • [2024-11-07 14:21:09]
  • 评测
  • 测评结果:WA
  • 用时:24ms
  • 内存:27880kb
  • [2024-11-07 14:21:08]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k,m;
struct com{
    int r,id;
    ll low,high;
    com(){r=low=high=0;}
    com(int a,ll b,ll c,int d){
        r=a,low=b,high=c;id=d;
    }
}a[400005];
vector<ll> p[400005];
int rank1[400005];
ll sum[400005];
bool cmp(com a,com b){
    return a.r>b.r;
}
ll ans[400005];
void __(){
    cin>>n>>m>>k;
    ll x,maxx;
    for(int i=1;i<=n;i++){
        p[i].clear();
        ans[i]=0;
        a[i]=com();
    }
    for(int i=1;i<=n;i++){
        cin>>rank1[i];sum[i]=0;maxx=0;
        for(int j=1;j<=m;j++){
            cin>>x;//sum+=x;
            if(x==-1) maxx+=k;
            else sum[i]+=x,maxx+=x;
            p[i].push_back(x);
        }
        a[i]=com(rank1[i],sum[i],maxx,i);
    }
    sort(a+1,a+1+n,cmp);
    //for(int i=1;i<=n;i++){
    //    cout<<a[i].r<<" "<<a[i].low<<" "<<a[i].high<<endl;
    //}
    //cout<<"*"<<endl;
    ans[a[1].id]=a[1].high;
    for(int i=2;i<=n;i++){
        //cout<<i<<" "<<a[i].id<<" "<<a[i].low<<" "<<a[i].high<<endl;
        if(a[i].low >= ans[a[i-1].id]){
            cout<<"No"<<endl;return;
        }
        else{
            ans[a[i].id]=min(a[i].high , ans[a[i-1].id]-1);
        }
    }
    cout<<"Yes"<<endl;
    for(int i=1;i<=n;i++){
        ans[i]-=sum[i];
        for(int j=0;j<p[i].size();j++){
            if(p[i][j]!=-1) cout<<p[i][j]<<" ";
            else{
                if(ans[i]>=k) cout<<k<<" ";
                else cout<<ans[i]<<" ";
                ans[i]=max(ans[i]-k,0ll);
            }
        }
        cout<<endl;
    }
    //cout<<endl;
}
int main(){
    ios::sync_with_stdio(false),cin.tie(nullptr);
    int _;cin>>_;while(_--)__();    
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 3ms
memory: 27880kb

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 5 
2 5 0 5 
3 5 1 4 
No
Yes
1 2 3 
4 5 6 
No
Yes
10000 10000 10000 
10000 10000 9999 

result:

ok ok 5 cases (5 test cases)

Test #2:

score: -100
Wrong Answer
time: 24ms
memory: 27376kb

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 
No
Yes
72716304 72716304 66436933 72716304 45419040 55642613 
72716304 62712753 72716304 21765515 56544945 12385026 
Yes
975402536 975402536 975402536 975402536 975402536 975402536 67482408 0 0 
975402536 975402536 975402536 975402536 211610436 944794448 67558026 0 0 
788675016 42...

result:

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