太悲了,76分蛙声一片。。。求助!!!
查看原帖
太悲了,76分蛙声一片。。。求助!!!
623557
Leaper_lyc楼主2023/8/30 09:58

提交记录 code:

#include <iostream>
#include <cstdio>

#define maxn 100005

int n, m, s, w[maxn], cnt = 0, f[maxn], tot = 0, num[maxn];

signed main() {
	scanf("%d%d%d", &n, &m, &s);
	int x, t = 0;
	for (int i = 1; i <= m; i++) {
		scanf("%d", &x);
		if (t + s > x) {
			w[++cnt] = x;
			num[++cnt] = i; 
		} else {
			t = x;
			f[++tot] = i;
		}
	}
	
	if ((t + s) > n){
		puts("NO");
		return 0;
	}
	t = n;
	f[++tot] = m + 1;
	for (int i = cnt; i >= 1; i--) {
		if (t - s < w[i]) {
			puts("NO");
			exit(0);
		} else {
			t = w[i];
			f[++tot] = num[i];
		}
	}
	f[++tot] = 0;
	
	puts("YES");
	
	for (int i = 1; i <= tot; i++) {
		printf("%d ", f[i]);
	}
}
2023/8/30 09:58
加载中...