結果

問題 No.1792 科学の甲子園
ユーザー 👑 NachiaNachia
提出日時 2021-12-21 00:05:40
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 10 ms / 4,000 ms
コード長 1,003 bytes
コンパイル時間 589 ms
コンパイル使用メモリ 76,764 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-17 18:40:53
合計ジャッジ時間 1,966 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
4,376 KB
testcase_01 AC 9 ms
4,376 KB
testcase_02 AC 10 ms
4,376 KB
testcase_03 AC 10 ms
4,376 KB
testcase_04 AC 9 ms
4,376 KB
testcase_05 AC 9 ms
4,376 KB
testcase_06 AC 9 ms
4,376 KB
testcase_07 AC 9 ms
4,376 KB
testcase_08 AC 9 ms
4,376 KB
testcase_09 AC 9 ms
4,376 KB
testcase_10 AC 9 ms
4,376 KB
testcase_11 AC 10 ms
4,380 KB
testcase_12 AC 10 ms
4,376 KB
testcase_13 AC 10 ms
4,376 KB
testcase_14 AC 10 ms
4,380 KB
testcase_15 AC 10 ms
4,380 KB
testcase_16 AC 9 ms
4,376 KB
testcase_17 AC 9 ms
4,380 KB
testcase_18 AC 9 ms
4,380 KB
testcase_19 AC 9 ms
4,376 KB
testcase_20 AC 10 ms
4,380 KB
testcase_21 AC 9 ms
4,376 KB
testcase_22 AC 10 ms
4,376 KB
testcase_23 AC 9 ms
4,380 KB
testcase_24 AC 9 ms
4,376 KB
testcase_25 AC 9 ms
4,380 KB
testcase_26 AC 9 ms
4,376 KB
testcase_27 AC 10 ms
4,376 KB
testcase_28 AC 10 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(n); i++)

int N;
i64 A[10000][6];
int maxi[64] = {};

int main() {
    cin >> N;
    rep(i,N) rep(j,6) cin >> A[i][j];
    rep(b,64){
        i64 maxscore = 0;
        rep(i,N){
            i64 score = 1;
            rep(t,6) if((b >> t) & 1) score *= A[i][t];
            if(score > maxscore){ maxi[b] = i; maxscore = score; }
        }
    }


    i64 ans = 0;
    rep(i,64) rep(j,i) rep(k,j) rep(l,k){
        i64 maxA[6] = {};
        rep(t,6) maxA[t] = max({ A[maxi[i]][t], A[maxi[j]][t], A[maxi[k]][t], A[maxi[l]][t] });
        i64 tmp = 1;
        rep(t,6) tmp *= maxA[t];
        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}


struct ios_do_not_sync{
    ios_do_not_sync(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    }
} ios_do_not_sync_instance;

0