TOPIC

Time Limit Exceeded

M. Imamul Hassan Khan asked 1 year ago

#include<iostream>
#include<map>
#include<cstdio>
#include<sstream>
using namespace std;

int main()
{
    long t,n,q; multimap<long, long> mp;
    scanf("%ld",&t);
    while(t--){
        scanf("%ld",&n);
        for(int i=1; i<=n; i++){
            scanf("%ld",&q);
            mp.insert(make_pair(q, i));
        }
        stringstream oss;
        for(auto i:mp){
            oss<<i.first<<" ";
        }
        string ss = oss.str();
        size_t found = ss.find_last_of(' ');
        ss.erase(found);
        printf("%s\n",ss.c_str());
        mp.clear();
    }

    return 0;
}

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.