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
",it->second); else { int t1 = it->first; int t2 = it->second; if(it != a.begin()) { it--; if(f - it->first <= t1 - f) printf("%d
",it->second); else printf("%d
",t2); } else printf("%d
",t2); } a[f] = id; } } return 0; }

좋은 웹페이지 즐겨찾기