QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#747323#9422. Two-star Contest568915433Compile Error//C++142.9kb2024-11-14 16:53:242024-11-14 16:53:25

Judging History

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

  • [2024-11-14 16:53:25]
  • 评测
  • [2024-11-14 16:53:24]
  • 提交

answer

#include "bits/stdc++.h"

using namespace std;

#define int long long
#define endl "\n"

vector<pair<int,int>> p;
vector<int> v[400005];

int u[400005][2];

bool cmp(pair<int,int> a1, pair<int,int> a2){
    return a1.first < a2.first;
}

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;
        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);            
            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()
    
    if(w==11){
        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;
    while(t--){
        so(w);
        w++;
    }
    
    
    
    
    
    
    
}

Details

answer.code: In function ‘void so(long long int)’:
answer.code:127:8: error: expected primary-expression before ‘)’ token
  127 |     if()
      |        ^