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@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-
2
给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外) 给我点赞的父母平安,天天发财,考上清北,绝对有效!!!(lqst2502除外)
-
1
//P2376 #include<bits/stdc++.h> using namespace std; struct node{ int x,t; }; int main(){ int n,m; cin>>n>>m; vector<node> v(n+m+5); for(int i=1;i<=n+m;i++) cin>>v[i].x; for(int i=1;i<=n+m;i++) cin>>v[i].t; vector<int> c(m+5),u(n+5); int cn1=0,cn2=0; for(int i=1;i<=n+m;i++){ if(v[i].t==1) c[++cn1]=v[i].x; else u[++cn2]=v[i].x; } vector<int> arr(m+3); for(int i=1;i<=n;i++){ int minn=1,minx=INT_MAX; for(int j=1;j<=m;j++){ if(abs(u[i]-c[j])<=minx){ if(abs(u[i]-c[j])==minx){ if(j<minn){ minx=abs(u[i]-c[j]); minn=j; } } else if(abs(u[i]-c[j])<minx){ minx=abs(u[i]-c[j]); minn=j; } } } arr[minn]++; } for(int i=1;i<=m;i++){ cout<<arr[i]<<" "; } return 0; } -
1
#include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } #include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } -
0
//J123 #include<bits/stdc++.h> using namespace std; struct node{ int x,t; }; int main(){ int n,m; cin>>n>>m; vector<node> v(n+m+5); for(int i=1;i<=n+m;i++) cin>>v[i].x; for(int i=1;i<=n+m;i++) cin>>v[i].t; vector<int> c(m+5),u(n+5); int cn1=0,cn2=0; for(int i=1;i<=n+m;i++){ if(v[i].t==1) c[++cn1]=v[i].x; else u[++cn2]=v[i].x; } vector<int> arr(m+3); for(int i=1;i<=n;i++){ int minn=1,minx=INT_MAX; for(int j=1;j<=m;j++){ if(abs(u[i]-c[j])<=minx){ if(abs(u[i]-c[j])==minx){ if(j<minn){ minx=abs(u[i]-c[j]); minn=j; } } else if(abs(u[i]-c[j])<minx){ minx=abs(u[i]-c[j]); minn=j; } } } arr[minn]++; } for(int i=1;i<=m;i++){ cout<<arr[i]<<" "; } return 0; } -
0
#include<bits/stdc++.h> #define int long long using namespace std; const int N=1e6+10; int a[N],b[N]; void solve() { priority_queue<int,vector<int>,greater<int>>q; int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { if(k>0) { k--; q.push(a[i]); } else { if(q.size()&&q.top()<a[i]) { m-=q.top(); q.pop(); q.push(a[i]); } else { m-=a[i]; } } if(m<=0) { cout<<i-1<<endl; return; } } cout<<n<<endl; } signed main() { //freopen("spire.in","r",stdin); //freopen("spire.out","w",stdout); cin.tie(0)->sync_with_stdio(0); cout.tie(0); int T; cin>>T; while(T--) { solve(); } return 0; } -
-1
@ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013) @ 刘丛睿 (lqst2025013)
Information
- ID
- 1324
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 3
- Tags
- (None)
- # Submissions
- 252
- Accepted
- 128
- Uploaded By
我们知道了同学数量和每个同学需要苹果的数量,那么: