結果
| 問題 |
No.1792 科学の甲子園
|
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2023-12-06 16:24:48 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 2,241 bytes |
| コンパイル時間 | 3,204 ms |
| コンパイル使用メモリ | 92,204 KB |
| 実行使用メモリ | 61,044 KB |
| 最終ジャッジ日時 | 2024-09-27 01:34:31 |
| 合計ジャッジ時間 | 9,727 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 TLE * 1 -- * 17 |
ソースコード
import java.io.*;
import java.util.*;
import java.util.stream.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner();
int n = sc.nextInt();
int[][] points = new int[n][6];
for (int i = 0; i < n; i++) {
for (int j = 0; j < 6; j++) {
points[i][j] = sc.nextInt();
}
}
long ans = 0;
for (int a = 0; a < n; a++) {
for (int b = a + 1; b < n; b++) {
for (int c = b + 1; c < n; c++) {
for (int d = c + 1; d < n; d++) {
long current = 1;
for (int i = 0; i < 6; i++) {
current *= Math.max(Math.max(points[a][i], points[b][i]), Math.max(points[c][i], points[d][i]));
}
ans = Math.max(ans, current);
}
}
}
}
System.out.println(ans);
}
}
class Utilities {
static String arrayToLineString(Object[] arr) {
return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
}
static String arrayToLineString(int[] arr) {
return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
}
}
class Scanner {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer("");
StringBuilder sb = new StringBuilder();
public Scanner() throws Exception {
}
public int nextInt() throws Exception {
return Integer.parseInt(next());
}
public long nextLong() throws Exception {
return Long.parseLong(next());
}
public double nextDouble() throws Exception {
return Double.parseDouble(next());
}
public int[] nextIntArray() throws Exception {
return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
}
public String next() throws Exception {
while (!st.hasMoreTokens()) {
st = new StringTokenizer(br.readLine());
}
return st.nextToken();
}
}
tenten