Submission #10345874


Source Code Expand

Copy
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int a[6];
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+n+1);
    if(n==1)
        cout<<a[1];
    else if(n==2)
        cout<<a[2];
    else if(n==3)
        cout<<max(a[1]+a[2],a[3]);
    if(n==4)
        cout<<min(max(a[1]+a[4],a[2]+a[3]),max(a[1]+a[3]+a[2],a[4]));
    cout<<endl;
    return 0;
}

Submission Info

Submission Time
Task A - 高橋君とお肉
User Teddy0818
Language C++ (GCC 5.4.1)
Score 100
Code Size 453 Byte
Status
Exec Time 1 ms
Memory 256 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0-sample-01.txt, subtask0-sample-02.txt, subtask0-sample-03.txt
All 100 / 100 subtask0-sample-01.txt, subtask0-sample-02.txt, subtask0-sample-03.txt, subtask1-01.txt, subtask1-02.txt, subtask1-03.txt, subtask1-04.txt, subtask1-05.txt, subtask1-06.txt, subtask1-07.txt, subtask1-08.txt, subtask1-09.txt, subtask1-10.txt, subtask1-11.txt, subtask1-12.txt, subtask1-13.txt, subtask1-14.txt, subtask1-15.txt, subtask1-16.txt
Case Name Status Exec Time Memory
subtask0-sample-01.txt 1 ms 256 KB
subtask0-sample-02.txt 1 ms 256 KB
subtask0-sample-03.txt 1 ms 256 KB
subtask1-01.txt 1 ms 256 KB
subtask1-02.txt 1 ms 256 KB
subtask1-03.txt 1 ms 256 KB
subtask1-04.txt 1 ms 256 KB
subtask1-05.txt 1 ms 256 KB
subtask1-06.txt 1 ms 256 KB
subtask1-07.txt 1 ms 256 KB
subtask1-08.txt 1 ms 256 KB
subtask1-09.txt 1 ms 256 KB
subtask1-10.txt 1 ms 256 KB
subtask1-11.txt 1 ms 256 KB
subtask1-12.txt 1 ms 256 KB
subtask1-13.txt 1 ms 256 KB
subtask1-14.txt 1 ms 256 KB
subtask1-15.txt 1 ms 256 KB
subtask1-16.txt 1 ms 256 KB