QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#526272#9176. Non-Interactive Nimhnust_xiaoqiWA 0ms3688kbC++20576b2024-08-21 12:52:282024-08-21 12:52:28

Judging History

你现在查看的是最新测评结果

  • [2024-08-21 12:52:28]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3688kb
  • [2024-08-21 12:52:28]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define endl "\n"

using namespace std;

const int N = 2e5;

typedef long long LL;
typedef pair<int, int> PII;

LL d[N];

void solve() {
	LL n,m;
	cin>>n>>m;
	for(LL i=1;i<=n;++i){
		cin>>d[i];
	}
	sort(d+1,d+n+1);
	for(LL i=1;i<=n;++i){
		LL data=(m%i!=0)+m/i;
		if(data>=d[i]){
			m-=d[i];
		}else{
			cout<<i-1<<endl;
			return;
		}
	}
	cout<<n<<endl;
}

signed main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0);
	
	int t = 1;
	// cin >> t;
	while(t--) {
		solve();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3688kb

input:

2
4
4 2 7 1
4
1 1 1 1

output:

1

result:

wrong output format Unexpected end of file - int32 expected (test case 1)