hdu 4584 map

#include 
using namespace std;
int main()
{
    int n;
    while(cin>>n&&n)
    {
        mapa;
        a.clear();
        a[1000000000] = 1;
        int id,f;
        for(int i=0;i::iterator it = a.lower_bound(f);
            if(it == a.end())
                printf("%d\n",it->second);
            else
            {
                int t1 = it->first;
                int t2 = it->second;
                if(it != a.begin())
                {
                    it--;
                    if(f - it->first <= t1 - f)
                        printf("%d\n",it->second);
                    else
                        printf("%d\n",t2);
                }
                else
                    printf("%d\n",t2);
            }
            a[f] = id;
        }
    }
    return 0;
}

你可能感兴趣的:(STL,==数据结构==)