Submission #1002056

# Submission time Handle Problem Language Result Execution time Memory
1002056 2024-06-19T09:33:35 Z vjudge1 Watching (JOI13_watching) C++14
Compilation error
0 ms 0 KB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define ins insert
#define pb push_back
#define pii pair<int, int>
#define endl '\n'
#define drop(x) cout<<(x)<<endl; return;
#define all(x) x.begin(),x.end()
vector<int> find_subset(int l, int r, vector<int> arr) {
    vector<int> tmp=arr;
    vector<int> ans;
    
    sort(all(arr),greater<int>());
    int n = arr.size();
    set<pair<int,int> > var;
    int asum=-1;
    for(int i =0;i<n;i++){
        if(arr[i]>r){
            continue;
        }
        if(arr[i]>=l){
            for(int j=0;j<n;j++){
                if(arr[i]==tmp[j]){
                    ans.pb(j);
                    break;
                }
            }
            return ans;
        }
        /*
            en boyuk sayi hansiki : sayi + arr[i]<=r
        */
        int frq = r-  arr[i];
        // cout<<arr[i]<<" max lazim "<<frq<<endl;
        // if(arr[i]==1){
        //     cout<<(*var.lower_bound({23,-1})).first<<endl;
        // }
        if(frq!=0){

            auto it = var.upper_bound({frq,2e9});
            if(it!=var.begin()){
                --it;
                int sum = (*it).first + arr[i];
                // cout<<arr[i]<<" buldum"<<" "<<(*it).first<<" sum: "<<sum<<endl;
                if(sum<=r){
                    var.ins({sum,(*it).first}); 
                    // cout<<sum<<" --------------- "<<(*it).first<<endl;
                    if(sum>=l){
                        asum=sum;
                        break;
                    }
                }

            }

        }
        var.ins({arr[i],-1});
    }
    // cout<<asum<<endl;
    vector<int> lst;
    while(asum!=-1){
        // cout<<"asumlar : "<<asum<<endl;
        auto it = var.lower_bound({asum,-1});
        
        int sec = (*it).second;
        if(sec==-1){
            sec=0;
            lst.pb(asum);
            break;
        }
        lst.pb(asum - sec);
        asum=sec;
    }
    // return lst;
    map<int,int> need;
    for(auto v:lst){
        need[v]++;
    }
    for(int j=0;j<n;j++){
        if(need[tmp[j]]){
            ans.pb(j);
            need[tmp[j]]--;
        }
    }

    return ans;
}

Compilation message

watching.cpp:1:10: fatal error: molecules.h: No such file or directory
    1 | #include "molecules.h"
      |          ^~~~~~~~~~~~~
compilation terminated.