QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#555632 | #8586. Party | RED1 | 0 | 0ms | 3544kb | C++14 | 463b | 2024-09-10 07:01:43 | 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%