Wrong Answer
Code
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
int main ()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int t; cin>>t;
while(t--)
{
int n; cin>>n;
vector<int>v(n);
for(int i=0; i<n; i++)
cin>>v[i];
int cnt=0;
sort(v.rbegin(),v.rend());
if(n>=3)
{
for(int i=0; i<=5; i++)
{
if(v[i]>0)
cnt++;
}
}
if(cnt==4)
cout<<v[0]-v[1]+v[2]-v[3]<<endl;
else if(cnt>=3)
cout<<v[0]-v[1]+v[2]<<endl;
else
cout<<v[0]-v[1]<<endl;
//cout<<cnt<<endl;
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1208 C. Game on Integer
- Contest
- Educational Round 1
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-07-14 17:12:36
- Judged At
- 2025-07-14 17:12:36
- Judged By
- Score
- 5
- Total Time
- 14ms
- Peak Memory
- 764.0 KiB