QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#686242#9422. Two-star ContestxydCatGirl#WA 29ms12492kbC++201.7kb2024-10-29 09:28:532024-10-29 09:28:55

Judging History

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

  • [2024-10-29 09:28:55]
  • 评测
  • 测评结果:WA
  • 用时:29ms
  • 内存:12492kb
  • [2024-10-29 09:28:53]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define pii pair<int, int>
#define ar(i) array<int, i>
using namespace std;
const int N=4e5+5, mod=1e9+7;
int n,m,k;
int genshin;
vector<int>p[N];
int l[N],r[N];
int s[N];
int id[N];
int ans[N];
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin>>genshin;
    while(genshin--){
        cin>>n>>m>>k;
        for(int i=1;i<=n;++i){
            id[i]=i;
            cin>>s[i];
            p[i].resize(m+1);
            int sum=0,cnt=0;
            for(int j=1;j<=m;++j){
                cin>>p[i][j];
                if(p[i][j]==-1)++cnt;
                else sum+=p[i][j];
            }
            l[i]=sum;
            r[i]=sum+cnt*k;
        }
        sort(id+1,id+1+n,[&](int x,int y){
            return s[x]<s[y];
        });
        int mx=0;
        bool flag=1;
        for(int i=1;i<=n;++i){
            int li=l[id[i]],ri=r[id[i]];
            if(mx+1>ri){
                flag=0;
                break;
            }
            ans[id[i]]=mx=max(mx+1ll,li);
            ans[id[i]]-=li;
        }
        if(!flag)
            cout<<"No"<<endl;
        else{
            cout<<"Yes"<<endl;
            for(int i=1;i<=n;++i){
                for(int j=1;j<=m;++j){
                    if(p[i][j]!=-1)
                        cout<<p[i][j]<<" ";
                    else{
                        if(ans[i]<=k)cout<<ans[i]<<" ";
                        else cout<<k<<" ";
                        ans[i]-=min(k,ans[i]);
                    }
                }
                cout<<endl;
            }
        }
    }
    // cerr<<fixed<<setprecision(2)<<(double)clock()/CLOCKS_PER_SEC<<endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 11904kb

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
2 0 0 
1 0 0 

result:

ok ok 5 cases (5 test cases)

Test #2:

score: -100
Wrong Answer
time: 29ms
memory: 12492kb

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:

No
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 975402536 9754025...

result:

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