1129 Recommendation System(25 分)

运行超时,尚未解决

#include
#include
#include
#include
#include
#include 
using namespace std;

multisetm;
mapma;

bool CMP(const pair& x, const pair& y)
{
    return x.second > y.second;
}
int main()
{
    int M,N,a;
    cin >> M >> N;

    cin >> a;
    m.insert(a);
    for (int i = 1; i < M; i++)
    {
        cin >> a;
        cout <::iterator it = m.begin(); it !=m.end(); it++)
        {
            //cout << *it <<" "< > v(ma.begin(), ma.end());
        sort(v.begin(), v.end(), CMP);
        /*for (map::iterator i = ma.begin(); it!=ma.end(); it++)
        {
            cout << it->first << " ";
        }*/
        for (vector >::iterator it = v.begin(); it!=v.end()&&it<(v.begin()+N); it++)
        {
            cout << " "<first;
        }
        cout << endl;
        m.insert(a);
    }
    system("pause");
    return 0;
}

你可能感兴趣的:(1129 Recommendation System(25 分))