记录详情

Accepted


  
# 状态 耗时 内存占用
#1 Accepted 1ms 204.0 KiB
#2 Accepted 2ms 224.0 KiB
#3 Accepted 2ms 220.0 KiB
#4 Accepted 1ms 232.0 KiB
#5 Accepted 1ms 220.0 KiB
#6 Accepted 1ms 224.0 KiB
#7 Accepted 1ms 216.0 KiB
#8 Accepted 1ms 228.0 KiB
#9 Accepted 1ms 220.0 KiB

代码

#include <iostream>
#include <algorithm>

using namespace std;

int a[1001],n,m,ans;
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=a[i];j++){
			ans+=(n-i+1);
		}
		if(ans>=m){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}

信息

递交者
类型
递交
题目
P1007 hitwh 2019 新生赛 H Songer and his army
语言
C++
递交时间
2020-12-17 20:19:58
评测时间
2020-12-17 20:19:58
评测机
分数
100
总耗时
16ms
峰值内存
232.0 KiB