結果

問題 No.1280 Beyond C
ユーザー tentententen
提出日時 2023-02-16 18:28:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 346 ms / 2,000 ms
コード長 2,116 bytes
コンパイル時間 3,826 ms
コンパイル使用メモリ 90,068 KB
実行使用メモリ 62,128 KB
最終ジャッジ日時 2023-09-25 22:42:26
合計ジャッジ時間 9,176 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
50,152 KB
testcase_01 AC 46 ms
50,140 KB
testcase_02 AC 46 ms
49,936 KB
testcase_03 AC 45 ms
49,864 KB
testcase_04 AC 45 ms
49,892 KB
testcase_05 AC 46 ms
49,836 KB
testcase_06 AC 45 ms
49,808 KB
testcase_07 AC 46 ms
50,204 KB
testcase_08 AC 46 ms
49,908 KB
testcase_09 AC 45 ms
49,924 KB
testcase_10 AC 45 ms
49,936 KB
testcase_11 AC 74 ms
51,332 KB
testcase_12 AC 51 ms
50,044 KB
testcase_13 AC 63 ms
49,944 KB
testcase_14 AC 64 ms
51,112 KB
testcase_15 AC 298 ms
60,020 KB
testcase_16 AC 233 ms
57,972 KB
testcase_17 AC 255 ms
59,896 KB
testcase_18 AC 314 ms
60,772 KB
testcase_19 AC 318 ms
61,472 KB
testcase_20 AC 346 ms
62,012 KB
testcase_21 AC 337 ms
61,712 KB
testcase_22 AC 340 ms
62,128 KB
権限があれば一括ダウンロードができます

ソースコード

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 m = sc.nextInt();
        long c = sc.nextLong();
        long[] valueA = new long[n];
        for (int i = 0; i < n; i++) {
            valueA[i] = sc.nextInt();
        }
        long[] valueB = new long[m];
        for (int i = 0; i < m; i++) {
            valueB[i] = sc.nextInt();
        }
        Arrays.sort(valueA);
        Arrays.sort(valueB);
        int right = 0;
        long ans = 0;
        for (int i = n - 1; i >= 0; i--) {
            while (right < m && valueA[i] * valueB[right] <= c) {
                right++;
            }
            ans += m - right;
        }
        System.out.println(new java.math.BigDecimal(1.0 * ans / m / n));
    }
}
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