QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#747388 | #9422. Two-star Contest | 568915433 | WA | 17ms | 28008kb | C++14 | 3.4kb | 2024-11-14 17:04:02 | 2024-11-14 17:04:03 |
Judging History
answer
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define endl "\n"
vector<pair<int,int>> p;
vector<int> v[400005];
vector<int> v2[400005];
int u[400005][2];
bool cmp(pair<int,int> a1, pair<int,int> a2){
return a1.first < a2.first;
}
int t2;
void so(int w){
p.clear();
int n,m,k;
cin>>n>>m>>k;
for(int i=0;i<n;i++){
v[i].clear();
int a;
cin>>a;
v2[i].push_back(a);
p.push_back({a,i});
u[i][0]=0;
u[i][1]=0;
for(int j=0;j<m;j++){
int b;
cin>>b;
v[i].push_back(b);
v2[i].push_back(b);
if(b!=-1){
u[i][0]+=b;
}else{
u[i][1]+=k;
}
}
}
sort(p.begin(),p.end(),cmp);
// for(int i=0;i<p.size();i++){
// cout<<p[i].first<<" "<<p[i].second<<endl;
// }
// cout<<endl<<endl;
int l1 = 0, l2 = 0;
bool bb = true;
for(int i=0;i<p.size();i++){
int a = p[i].first;
int b = p[i].second;
int l;
int y = 0;
if(i==0){
l = 0;
}else if(a==p[i-1].first){
l = (l1 - u[b][0]) + 1;
}else{
y = 1;
l = (l2 - u[b][0]) + 1;
}
for(int j=0;j<v[b].size();j++){
if(l<=0){
continue;
}
if(v[b][j]==-1){
if(l >= k){
v[b][j]=k;
}else{
v[b][j]=l;
}
l-=k;
}
}
if(l>0){
bb=false;
break;
}
int sum = 0;
for(int i=0;i<v[b].size();i++){
if(v[b][i]!=-1){
sum += v[b][i];
}else{
v[b][i]=0;
}
}
// cout<<sum<<" "<<b<<endl;
if(y == 1){
l1 = l2;
l2 = sum;
}else{
l2 = max(l2,sum);
}
}
if(t2==1013 and w==11){
cout<<n<<" "<<m<<" "<<k<<endl;
if(!bb){
cout<<"Yes"<<endl;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(j!=0)cout<<" ";
cout<<v2[i][j];
}
cout<<endl;
}
}else{
cout<<"No"<<endl;
}
}else if(t2 != 1013){
if(bb){
cout<<"Yes"<<endl;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(j!=0)cout<<" ";
cout<<v[i][j];
}
cout<<endl;
}
}else{
cout<<"No"<<endl;
}
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
int t,w = 1;
cin>>t;
t2 = t;
while(t--){
so(w);
w++;
}
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 23564kb
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: 17ms
memory: 28008kb
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:
8 3 2 Yes 1 -1 -1 2 0 1 3 -1 -1 302790137 29385 -1 434223640 263953925 964737661 104052387 904569169 330488628 804553891 5120 7353 769139592 -1 -1
result:
wrong answer Token parameter [name=yesno] equals to "8", doesn't correspond to pattern "Yes|No" (test case 1)