結果
| 問題 |
No.1792 科学の甲子園
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-12-21 00:05:40 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 4,000 ms |
| コード長 | 1,003 bytes |
| コンパイル時間 | 2,175 ms |
| コンパイル使用メモリ | 102,224 KB |
| 最終ジャッジ日時 | 2025-01-27 04:16:13 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
#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;
Nachia