QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#526272 | #9176. Non-Interactive Nim | hnust_xiaoqi | WA | 0ms | 3688kb | C++20 | 576b | 2024-08-21 12:52:28 | 2024-08-21 12:52:28 |
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;
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)