Submission #241611


Source Code Expand

Copy
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;

int main()
{
    int n;
    int t[4];
    scanf("%d",&n);
    for(int i=0;i < n;++i) scanf("%d",&t[i]);
    if (n == 1) {
        printf("%d\n",t[0]);
    } else if (n == 2) {
        printf("%d\n", max(t[0],t[1]));
    } else {
        sort(t, t+n);
        if (n == 3) {
            if (t[2] > (t[0]+t[1])) printf("%d\n", t[2]);
            else printf("%d\n", t[0]+t[1]);
        } else {
            if (t[4] > t[0] + t[1] + t[2]) printf("%d\n", t[4]);
            else if (t[1] + t[2] > t[0] + t[3]) printf("%d\n", t[1]+t[2]);
            else printf("%d\n", t[0]+t[3]);
        }
    }
    return 0;
}

Submission Info

Submission Time
Task A - 高橋君とお肉
User Izryt
Language C++ (G++ 4.6.4)
Score 0
Code Size 734 Byte
Status
Exec Time 25 ms
Memory 804 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:11:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:12:45: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

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 0 / 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 25 ms 692 KB
subtask0-sample-02.txt 24 ms 700 KB
subtask0-sample-03.txt 22 ms 704 KB
subtask1-01.txt 22 ms 704 KB
subtask1-02.txt 22 ms 796 KB
subtask1-03.txt 24 ms 800 KB
subtask1-04.txt 22 ms 800 KB
subtask1-05.txt 24 ms 796 KB
subtask1-06.txt 24 ms 804 KB
subtask1-07.txt 22 ms 800 KB
subtask1-08.txt 24 ms 652 KB
subtask1-09.txt 22 ms 696 KB
subtask1-10.txt 23 ms 796 KB
subtask1-11.txt 24 ms 704 KB
subtask1-12.txt 24 ms 652 KB
subtask1-13.txt 24 ms 700 KB
subtask1-14.txt 23 ms 804 KB
subtask1-15.txt 24 ms 700 KB
subtask1-16.txt 23 ms 672 KB