結果

問題 No.1792 科学の甲子園
ユーザー tentententen
提出日時 2023-12-06 16:24:48
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 2,241 bytes
コンパイル時間 4,482 ms
コンパイル使用メモリ 91,620 KB
実行使用メモリ 63,532 KB
最終ジャッジ日時 2023-12-06 16:25:00
合計ジャッジ時間 9,987 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
53,980 KB
testcase_01 AC 60 ms
53,960 KB
testcase_02 AC 55 ms
53,984 KB
testcase_03 AC 54 ms
53,984 KB
testcase_04 AC 54 ms
53,972 KB
testcase_05 AC 54 ms
53,980 KB
testcase_06 AC 54 ms
53,976 KB
testcase_07 AC 55 ms
53,984 KB
testcase_08 AC 87 ms
55,016 KB
testcase_09 AC 135 ms
56,568 KB
testcase_10 AC 55 ms
53,992 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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();
    }
    
}
0