QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#96673 | #5481. Beast Bullies | monkedluffy# | WA | 69ms | 6752kb | C++23 | 768b | 2023-04-15 00:50:30 | 2023-04-15 00:50:34 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
ll n; cin >> n;
vector<ll> a(n);
for(ll i = 0; i < n; i++) cin >> a[i];
sort(a.begin(), a.end());
if(n == 1) {
cout << "1\n";
} else {
ll cur = 0, cnt = 0, ans = 1;
for(ll i = n - 2; i >= 0; i--) {
cur += a[i];
cnt++;
if(cur >= a.back()) {
ans = max(cnt + 1, ans);
break;
}
}
cout << ans << '\n';
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
//cin >> t;
while(t--){
cout << fixed << setprecision(15);
solve();
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 69ms
memory: 6752kb
input:
500000 976631732 51389671 729809897 630844317 294721017 903231515 477913449 871071076 636104080 345822085 97441187 499323378 522845426 310022664 199310190 776622973 602672555 646874222 214723272 285341530 962727359 681361226 47426538 272153520 693133904 542337627 556307610 325596239 95738088 5495543...
output:
3
result:
wrong answer 1st lines differ - expected: '155101', found: '3'