记录详情

Accepted


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

代码

#include<bits/stdc++.h>
using namespace std;
const int maxn=1007;
int n,m;
int a[maxn];
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    sort(a+1,a+1+n);
    long long C=0;
    for(int i=1;i<=n;i++){
        C+=a[i]*(n-i+1ll);
        if(C>=m)return puts("Yes"),0;
    }
    puts("No");
    return 0;
}

信息

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