codeforces B. Restoration of the Permutation
来源:互联网 发布:淘宝包包拍照技巧 编辑:程序博客网 时间:2024/04/30 01:54
#include<iostream>#include<cstdio>#include<cstring>using namespace std;bool flag[1005];int a[1005],b[1005];int main(){ int n; int i,j,k; while(scanf("%d%d",&n,&k)==2) { for(i=1;i<=n;i++) { scanf("%d",&b[i]); } memset(flag,false,sizeof(flag)); j=0; int t=0; while(t<n) { for(i=1;i<=n;i++) { if(b[i]==0&&!flag[i]) {flag[i]=true;break;} } a[j]=i; for(i=1;i<=n;i++) { if(a[j]>=i+k) b[i]--; } j++; t++; } printf("%d",a[0]); for(i=1;i<n;i++) printf(" %d",a[i]); printf("\n"); } return 0;}
- codeforces B. Restoration of the Permutation
- Restoration of the Permutation
- codeforces 889B. Restoration of string(拓扑排序)
- Codeforces 889B (Codeforces Round #445 Div. 1) Restoration of string 图论
- Codeforces 618B Guess the Permutation
- CodeForces 618B-Guess the Permutation【搜索】
- codeforces B. Permutation
- CodeForces-137B Permutation
- Codeforces-137B-Permutation
- Codeforces 359B Permutation
- CodeForces 618 B. Guess the Permutation(水~)
- CodeForces - 618B Guess the Permutation (模拟)
- Codeforces--618B--Guess the Permutation(规律)
- 【CodeForces 618B】Guess the Permutation(水题)
- B. Guess the Permutation
- Codeforces 890 D. Restoration of string (技巧)
- Codeforces 625B - War of the Corporations
- CodeForces 625B War of the Corporations
- 交互设计:Axure学习一
- 函数指针的几种用法
- Hoj 1086 Don't Get Rooked
- mybatis帮助类dome
- weblogic安装运行出现的问题
- codeforces B. Restoration of the Permutation
- 1 Power of Cryptography
- hdu3487 Play with Chain(Splay)
- 八个脚的 OTP音乐芯片原理资料-AC2100 MUSIC IC
- selenium webdriver + Junit 自动化测试:打开不同浏览器网页
- 常用排序算法
- hdu 3466
- 编程原则
- hdu 2780 Su-Su-Sudoku (dfs解的数独)