QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#555632#8586. PartyRED10 0ms3544kbC++14463b2024-09-10 07:01:432024-09-10 07:01:43

Judging History

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

  • [2024-09-10 07:01:43]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3544kb
  • [2024-09-10 07:01:43]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define Algerian ios::sync_with_stdio(false);
#define OI cin.tie(NULL);

int main (){
    Algerian OI
    int n; cin >> n;
    vector<int> a(n);
    for(auto &i : a) cin >> i;
    int seats = (n+1)/2;
    ll ans = 0;
    sort(a.begin(),a.end(),greater<int>());
    for (int i = 0; i < n && seats>0; ++i){
        if(a[i]<0) break;
        ans += a[i];
    }
    cout << ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

5
3 2 -1 4 5

output:

14

result:

wrong answer 1st lines differ - expected: '12', found: '14'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%