#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(v.begin(),v.end(),x)-v.begin();
return ans;
}
// static int n, x, y;
// static vector<int> a, b;
//
// signed main() {
// assert(scanf("%d %d %d", &n, &x, &y) == 3);
// a.resize(n);
// b.resize(n);
// for (int i = 0; i < n; i++) {
// assert(scanf("%d %d", &a[i], &b[i]) == 2);
// }
//
// fclose(stdin);
//
// int answer = find_maximum_unique(x, y, a, b);
//
// printf("%d\n", answer);
// }
//
// void solve() {
//
// }
//
// signed main() {
// ios_base::sync_with_stdio(false);
// cin.tie(nullptr);
// int t = 1;
// cin >> t;
// while (t--) {
// solve();
// }
// }
# | 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... |