QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#96673#5481. Beast Bulliesmonkedluffy#WA 69ms6752kbC++23768b2023-04-15 00:50:302023-04-15 00:50:34

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-15 00:50:34]
  • 评测
  • 测评结果:WA
  • 用时:69ms
  • 内存:6752kb
  • [2023-04-15 00:50:30]
  • 提交

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'