結果

問題 No.1792 科学の甲子園
ユーザー asaringoasaringo
提出日時 2022-01-31 22:43:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,267 bytes
コンパイル時間 1,813 ms
コンパイル使用メモリ 172,940 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-02 02:25:43
合計ジャッジ時間 3,444 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef long double ld ;
typedef pair<ll,ll> P ;
typedef tuple<bool,ll,ll,ll> TP ;
#define chmin(a,b) a = min(a,b)
#define chmax(a,b) a = max(a,b)
#define bit_count(x) __builtin_popcountll(x)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a / gcd(a,b) * b
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define rrep(i,a,b) for(int i = a ; i < b ; i++)
#define endl "\n"

int n ;
vector<P> X[6] ;
ll A[1010][6] ;

int main(){
    cin >> n ;
    rep(i,n){
        rep(j,6) cin >> A[i][j] , X[j].push_back(P(A[i][j],i)) ;
    }
    rep(i,6) sort(X[i].begin(),X[i].end(),greater<P>()) ;
    ll res = 0 ;
    rep(S,1<<6){
        if(bit_count(S) != 4) continue ;
        vector<ll> vec(6,0) ;
        rep(i,6) if(S >> i & 1) vec[i] = X[i][0].first ;
        rep(i,6){
            if(!(S >> i & 1)) continue ;
            int j = 0 ;
            while(j < n && X[i][j].first == vec[i]){
                rep(k,6) if(!(S >> k & 1)) {
                    int id = X[i][j].second ;
                    vec[k] = max(vec[k],A[id][k]) ;
                }
                j++ ;
            }
        }
        ll sum = 1 ;
        rep(i,6) sum *= vec[i] ;
        chmax(res,sum) ;
    }
    cout << res << endl ;
}
0