CF415AMashmokh and Lights(map)

题目链接:http://codeforces.com/problemset/problem/415/A

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

int main()
{
    map<int ,int> p;
    int n,m;
    while(~scanf("%d%d",&n,&m))
    {
        int a;
        p.clear();
        while(m--)
        {
            cin>>a;
            for(int i=a;i<=n;i++)
            {
                if(p[i]==0)
                    p[i]=a;
            }
        }
        for(int i=1;i<=n;i++)
            cout<<p[i]<<" ";
        cout<<endl;
    }
    return 0;
}


你可能感兴趣的:(CF415AMashmokh and Lights(map))