QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#526291 | #9176. Non-Interactive Nim | hnust_xiaoqi | WA | 0ms | 3712kb | C++20 | 752b | 2024-08-21 12:59:31 | 2024-08-21 12:59:33 |
Judging History
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;
LL m2=m;
for(LL i=1;i<=n;++i){
cin>>d[i];
}
sort(d+1,d+n+1);
LL ans=0;
for(LL i=1;i<=n;++i){
LL data=(m%i!=0)+m/i;
if(data>=d[i]){
m-=d[i];
}else{
ans=i-1;
break;
}
}
if(!n) ans=n;
LL cnt=1;
m=m2;
for(LL i=n;i;--i){
LL data=(m%cnt!=0)+m/cnt;
if(data>=d[i]){
m-=d[i];
++cnt;
}
}
ans=min(ans,cnt-1);
cout<<ans<<endl;
}
signed main()
{
ios::sync_with_stdio(false), cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
while(t--) {
solve();
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3712kb
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)