1. 程式人生 > 其它 >錯誤:為倉庫 'BaseOS' 下載元資料失敗 : Cannot prepare internal mirrorlist: No URLs in mirrorlist

錯誤:為倉庫 'BaseOS' 下載元資料失敗 : Cannot prepare internal mirrorlist: No URLs in mirrorlist

// Problem: P1478 陶陶摘蘋果(升級版)
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P1478
// Memory Limit: 125 MB
// Time Limit: 1000 ms
// User: Pannnn

#include <bits/stdc++.h>

using namespace std;

template<class T>
void debugVector(const T &a) {
    cout << "[ ";
    for (size_t i = 0; i < a.size(); ++i) {
        cout << a[i] << (i == a.size() - 1 ? " " : ", ");
    }
    cout << "]" << endl;
}

template<class T>
void debugMatrix2(const T &a) {
    for (size_t i = 0; i < a.size(); ++i) {
        debugVector(a[i]);
    }
}

template<class T>
using matrix2 = vector<vector<T>>;

template<class T>
vector<vector<T>> getMatrix2(size_t n, size_t m, T init = T()) {
    return vector<vector<T>>(n, vector<T>(m, init));
}

template<class T>
using matrix3 = vector<vector<vector<T>>>;

template<class T>
vector<vector<vector<T>>> getMatrix3(size_t x, size_t y, size_t z, T init = T()) {
    return vector<vector<vector<T>>>(x, vector<vector<T>>(y, vector<T>(z, init)));
}

vector<int> genBigInteger(string a) {
    vector<int> res;
    for (int i = a.size() - 1; i >= 0; --i) {
        res.push_back(a[i] - '0');
    }
    return res;
}

void printBigInteger(vector<int> a) {
    for (size_t i = a.size() - 1; i >= 0; --i) {
        cout << a[i];
    }
}

vector<int> addBigInteger(vector<int> a, vector<int> b) {
    vector<int> res;
    int pre = 0;
    for (size_t i = 0; i < a.size() || i < b.size() || pre; ++i) {
        if (i < a.size()) pre += a[i];
        if (i < b.size()) pre += b[i];
        res.push_back(pre % 10);
        pre /= 10;
    }
    return res;
}

bool compare(const pair<int, int> p1, const pair<int, int> p2) {
     if (p1.second < p2.second) {
         return true;
     }
     return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, s;
    cin >> n >> s;
    int a, b;
    cin >> a >> b;
    
    vector<pair<int, int>> info(n);
    
    for (int i = 0; i < n; ++i) {
        cin >> info[i].first >> info[i].second;
    }
    sort(info.begin(), info.end(), compare);
    
    int cnt = 0;
    for (int i = 0; i < n && s >= info[i].second; ++i) {
        if (info[i].first <= a + b) {
            ++cnt;
            s -= info[i].second;
        }
    }
    cout << cnt << endl;
    return 0;
}