#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
// template <class T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//
// // #define int long long
#define rep(i,a,b) for (int i = a; i < b; i++)
#define rrep(i,a,b) for (int i = a; i >= b; i--)
// void N() {cout<<"NO\n";}
// void Y() {cout<<"YES\n";}
// void isTrue(bool ope) {if (ope) Y();else N();}
// int pw(int x,int t) {int res = 1;while (t--) res *= x;return res;}
// int lg(int x,int b) {int res = 0;while (x >= b) {x/=b;res++;}return res;}
// int MD = 1e9+7;
// // int MX_VL = 1e18;
// int MX_ll = 2e9;
//
// bool check(vector<int>& a,int x,int y,int m) {
// int sm = 0;
// rep(i,0,m) sm += a[i];
// vector<bool> dp(min(x,sm)+1,false);
// dp[0] = true;
// rep(i,0,m) {
// rrep(j,min(x,sm),a[i]) {
// dp[j] = dp[j]| dp[j-a[i]];
// }
// }
// rep(i,0,min(x+1,sm+1)) {
// if (dp[i]) {
// if (y >= sm-i) return true;
// }
// }
// return false;
// }
int find_maximum_unique(int x,int y,vector<int> a,vector<int> b) {
vector<int> v(a.begin(),a.end());
int n = v.size();
sort(v.begin(),v.end());
vector<int> pref(n);
pref[0] = v[0];
rep(i,1,n) {
pref[i] = pref[i-1]+v[i];
}
int ans = upper_bound(pref.begin(),pref.end(),x)-pref.begin();
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |