Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define ll long long
- #define ull unsigned long long int
- #define ld long double
- #define pb push_back
- #define p_b pop_back
- #define si stack<int>
- #define sll stack<ll>
- #define sc stack<char>
- #define vi vector<int>
- #define vll vector<ll>
- #define mii map<int, int>
- #define msi map<string, int>
- #define mci map<char, int>
- #define qc queue<char>
- #define qi queue<int>
- #define qll queue<ll>
- using namespace std;
- int main(){
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- int t;
- cin >> t;
- while(t--){
- int n;
- cin >> n;
- map<ll, int> m;
- set<ll> s;
- vll v;
- for(int i = 0; i < n; i++){
- ll a;
- cin >> a;
- m[a]++;
- v.pb(a);
- }
- if(n == 1){
- cout << "1\n";
- cout << v[0] << "\n";
- } else{
- ll sum = 0, p = 0, tot = 0;;
- for(auto i = m.begin(); i != m.end()--; i++){
- auto k = i;
- k++;
- if((i->first)*(i->second)+sum < k->first){
- p = i->first;
- tot += i->second;
- }
- sum += (i->first)*(i->second);
- }
- cout << n-tot << "\n";
- for(int i = 1; i <= n; i++){
- if(v[i-1] > p){
- cout << i << " ";
- }
- }
- cout << "\n";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement