結果

問題 No.1280 Beyond C
ユーザー tentententen
提出日時 2022-08-04 17:48:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 336 ms / 2,000 ms
コード長 1,517 bytes
コンパイル時間 2,485 ms
コンパイル使用メモリ 74,392 KB
実行使用メモリ 61,660 KB
最終ジャッジ日時 2023-10-12 15:38:59
合計ジャッジ時間 7,246 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,408 KB
testcase_01 AC 43 ms
49,500 KB
testcase_02 AC 42 ms
49,624 KB
testcase_03 AC 43 ms
49,356 KB
testcase_04 AC 42 ms
49,544 KB
testcase_05 AC 43 ms
49,540 KB
testcase_06 AC 42 ms
49,504 KB
testcase_07 AC 43 ms
49,408 KB
testcase_08 AC 42 ms
47,904 KB
testcase_09 AC 42 ms
49,764 KB
testcase_10 AC 43 ms
49,508 KB
testcase_11 AC 57 ms
50,776 KB
testcase_12 AC 48 ms
49,364 KB
testcase_13 AC 58 ms
50,460 KB
testcase_14 AC 56 ms
50,648 KB
testcase_15 AC 272 ms
59,452 KB
testcase_16 AC 238 ms
59,096 KB
testcase_17 AC 257 ms
59,008 KB
testcase_18 AC 266 ms
60,492 KB
testcase_19 AC 258 ms
60,572 KB
testcase_20 AC 332 ms
61,116 KB
testcase_21 AC 336 ms
61,660 KB
testcase_22 AC 328 ms
61,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

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[] typeA = new long[n];
        for (int i = 0; i < n; i++) {
            typeA[i] = sc.nextInt();
        }
        long[] typeB = new long[m];
        for (int i = 0; i < m; i++) {
            typeB[i] = sc.nextInt();
        }
        Arrays.sort(typeA);
        Arrays.sort(typeB);
        int right = m;
        double ans = 0;
        for (int i = 0; i < n; i++) {
            while (right >= 1 && typeA[i] * typeB[right - 1] > C) {
                right--;
            }
            ans += m - right;
        }
        System.out.println(ans / n / m);
    }
}

class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    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 String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0