Source Code
#include <iostream>
#include <algorithm>
int n;
int loki[1000001];
using namespace std;
int main() {

cin>>n;
for(int i=0;i<n;i++){
  cin>>loki[i];
}
sort(loki,loki+n);
int max=0;
int x;
for(int i=0;i<n;i++){
  x=loki[i]+loki[i+1];
  if(x>max){
max=x;
  }
}
cout<<max;

}
Copy
Movies King_Of_Asgard
GNU G++17
349 ms
4.4 MB
Wrong Answer