Submission #2857457


Source Code Expand

#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll n, m, x, y, z, a[10][1100], res;
int main(void){
    // Your code here!
    cin >> n >> m;
    for (ll i = 0; i < n; i++) {
        cin >> x >> y >> z;
        for (ll j = 0; j < 2; j++) {
            for (ll k = 0; k < 2; k++) {
                for (ll l = 0; l < 2; l++) {
                    a[j * 4 + k * 2 + l][i] = x * (j ? 1 : -1) + y * (k ? 1 : -1) + z * (l ? 1 : -1);
                }
            }
        }
    }
    for (ll i = 0; i < 8; i++) {
        sort(a[i] , a[i] + n);
        reverse(a[i], a[i] + n);
    }
    for (ll i = 0; i < 8; i++) {
        ll ans = 0;
        for (ll j = 0; j < m; j++) {
            if (a[i][j] <= 0) break;
            ans += a[i][j];
        }
        res = max(res, ans);
    }
    cout << res << endl;
}

Submission Info

Submission Time
Task D - Patisserie ABC
User kwfumou1242
Language C++14 (GCC 5.4.1)
Score 0
Code Size 874 Byte
Status WA
Exec Time 3 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 4
AC × 16
WA × 4
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Case Name Status Exec Time Memory
in01.txt AC 3 ms 256 KB
in02.txt AC 3 ms 256 KB
in03.txt AC 3 ms 256 KB
in04.txt AC 3 ms 256 KB
in05.txt WA 3 ms 256 KB
in06.txt WA 3 ms 256 KB
in07.txt WA 3 ms 256 KB
in08.txt AC 2 ms 256 KB
in09.txt AC 2 ms 256 KB
in10.txt AC 2 ms 256 KB
in11.txt AC 3 ms 256 KB
in12.txt AC 3 ms 256 KB
in13.txt AC 2 ms 256 KB
in14.txt AC 2 ms 256 KB
in15.txt AC 2 ms 256 KB
in16.txt WA 2 ms 256 KB
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
sample_04.txt AC 1 ms 256 KB