QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#649214#8936. Team ArrangementargtargCompile Error//C++201.9kb2024-10-17 22:07:072024-10-17 22:07:07

Judging History

This is the latest submission verdict.

  • [2024-10-17 22:07:07]
  • Judged
  • [2024-10-17 22:07:07]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define pii pair<int, int>
void solve();

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int T = 1;
//    cin >> T;
    while (T--)solve();
    return 0;
}
void solve(){
    int n;
    cin>>n;
    vector<pii>a(n+1);
    for(int i=1;i<=n;i++){
        cin>>a[i].first>>a[i].second;
    }
    sort(a.begin()+1,a.end());
    int ans=-1e10;
    vector<int>num(n+1),w(n+1);
    for(int i=1;i<=n;i++){
        cin>>w[i];
    }
    int cnt=0,ccnt=0;
    vector<vector<int>>c(n+1,vector<int>(n+1));
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            c[i][j]=i/j;
        }
    }
    auto dfs=[&](auto dfs,int re,int x)->void{
        cnt++;
        if(re==0){
            ccnt++;
            priority_queue<int,vector<int>,greater<int>>q;
            long long tmp=0;
            int ok=1,l=1;
            for(int i=1;i<=n;i++){
                if(ok==0)break;
//                cout<<num[i]<<' ';
                tmp+=1ll*num[i]*w[i];
                while(l<=n&&a[l].first<=i){
                    q.push(a[l].second);
                    l++;
                }
                for(int j=0;j<num[i]*i;j++) {
                    if(q.size()&&q.top()>=i){
                        q.pop();
                    }
                    else {
                        ok=0;
                        break;
                    }
                }
            }
//            cout<<endl;
            if(ok==1)ans=max(ans,tmp);
            return;
        }
        if(ok==1)ans=max(ans,tmp);
        return;
    }
        for(int j=0;j<=re;j+=x){
            num[x]=c[j][x];
            dfs(dfs,re-j,min(x-1,re-j));
            num[x]=0;
        }
    };
    dfs(dfs,n,n);

    cout<<(ans==-1e10 ? "impossible":to_string(ans))<<endl;
}

詳細信息

answer.code: In lambda function:
answer.code:67:12: error: ‘ok’ was not declared in this scope
   67 |         if(ok==1)ans=max(ans,tmp);
      |            ^~
answer.code:67:30: error: ‘tmp’ was not declared in this scope; did you mean ‘tm’?
   67 |         if(ok==1)ans=max(ans,tmp);
      |                              ^~~
      |                              tm
answer.code: In function ‘void solve()’:
answer.code:70:9: error: expected ‘,’ or ‘;’ before ‘for’
   70 |         for(int j=0;j<=re;j+=x){
      |         ^~~
answer.code:70:21: error: ‘j’ was not declared in this scope
   70 |         for(int j=0;j<=re;j+=x){
      |                     ^
answer.code:70:24: error: ‘re’ was not declared in this scope
   70 |         for(int j=0;j<=re;j+=x){
      |                        ^~
answer.code:70:30: error: ‘x’ was not declared in this scope
   70 |         for(int j=0;j<=re;j+=x){
      |                              ^
answer.code: At global scope:
answer.code:76:8: error: expected constructor, destructor, or type conversion before ‘(’ token
   76 |     dfs(dfs,n,n);
      |        ^
answer.code:78:5: error: ‘cout’ does not name a type
   78 |     cout<<(ans==-1e10 ? "impossible":to_string(ans))<<endl;
      |     ^~~~
answer.code:79:1: error: expected declaration before ‘}’ token
   79 | }
      | ^