Codeforces Round #240 (Div. 2), problem: (A) Mashmokh and Lights editorial: http://codeforces.com/blog/entry/11470
Codeforces Round #240 (Div. 2), problem: (A) Mashmokh and Lights solution: http://ideone.com/L0KBrj
#include <iostream> #include <cstdio> #include <cstring> using namespace std; int main() { int n, m, b[105], a; memset(b, 0, sizeof(b)); scanf("%d%d", &n, &m); while(m--) { scanf("%d", &a); for(int i=a-1; i<n; i++) { if(b[i]==0) b[i]=a; else break; } } for(int i=0; i<n; i++) printf("%d ", b[i]); return 0; }
No comments:
Post a Comment