Submission #241437


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 {
            printf("%d\n", max(abs(t[0]+t[3]),abs(t[1]+t[2])));
        }
    }
    return 0;
}

Submission Info

Submission Time
Task A - 高橋君とお肉
User Izryt
Language C++ (G++ 4.6.4)
Score 0
Code Size 612 Byte
Status
Exec Time 29 ms
Memory 796 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 27 ms 732 KB
subtask0-sample-02.txt 25 ms 796 KB
subtask0-sample-03.txt 25 ms 748 KB
subtask1-01.txt 28 ms 732 KB
subtask1-02.txt 28 ms 796 KB
subtask1-03.txt 26 ms 796 KB
subtask1-04.txt 27 ms 784 KB
subtask1-05.txt 27 ms 728 KB
subtask1-06.txt 26 ms 792 KB
subtask1-07.txt 28 ms 724 KB
subtask1-08.txt 28 ms 792 KB
subtask1-09.txt 27 ms 732 KB
subtask1-10.txt 26 ms 792 KB
subtask1-11.txt 26 ms 796 KB
subtask1-12.txt 27 ms 728 KB
subtask1-13.txt 28 ms 792 KB
subtask1-14.txt 29 ms 796 KB
subtask1-15.txt 26 ms 740 KB
subtask1-16.txt 28 ms 748 KB