Submission #603412


Source Code Expand

Copy
#include <bits/stdc++.h>

using namespace std;

int t[4];

int main()
{
    int n; cin >> n;

    for (int i = 0; i < n; ++i) cin >> t[i];

    int mi = 300;

    for (int i = 0; i < (1 << n); ++i) {
        int a = 0, b = 0;

        for (int j = 0; j < n; ++j) {
            if (i >> j & 1) a += t[j];
            else b += t[j];
        }

        mi = min(mi, max(a, b));
    }

    cout << mi << endl;
}

Submission Info

Submission Time
Task A - 高橋君とお肉
User Izryt
Language C++ (G++ 4.6.4)
Score 100
Code Size 436 Byte
Status
Exec Time 27 ms
Memory 924 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 23 ms 792 KB
subtask0-sample-02.txt 23 ms 792 KB
subtask0-sample-03.txt 25 ms 916 KB
subtask1-01.txt 24 ms 796 KB
subtask1-02.txt 23 ms 668 KB
subtask1-03.txt 24 ms 796 KB
subtask1-04.txt 24 ms 920 KB
subtask1-05.txt 24 ms 796 KB
subtask1-06.txt 23 ms 920 KB
subtask1-07.txt 25 ms 668 KB
subtask1-08.txt 25 ms 796 KB
subtask1-09.txt 24 ms 920 KB
subtask1-10.txt 24 ms 668 KB
subtask1-11.txt 24 ms 676 KB
subtask1-12.txt 24 ms 796 KB
subtask1-13.txt 22 ms 924 KB
subtask1-14.txt 24 ms 796 KB
subtask1-15.txt 24 ms 804 KB
subtask1-16.txt 27 ms 800 KB