QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#65414 | #5122. Strange Sum | ressoa | WA | 2ms | 3320kb | C++17 | 477b | 2022-11-30 15:37:57 | 2022-11-30 15:38:00 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
int n;
cin>>n;
ll a[n+1];
for(int i=1;i<=n;i++)cin>>a[i];
sort(a+1,a+n+1);
ll ans=0;
for(int i=n-1;i>=max(0,n-2);i--){
ans+=max(0ll,a[i]);
}
cout<<ans<<'\n';
return void();
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t=1;
// cin>>t;
while(t--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3320kb
input:
4 1 4 3 2
output:
5
result:
wrong answer 1st numbers differ - expected: '7', found: '5'