結果
問題 | No.989 N×Mマス計算(K以上) |
ユーザー | Kodai |
提出日時 | 2020-04-17 16:43:04 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 830 ms / 2,000 ms |
コード長 | 1,362 bytes |
コンパイル時間 | 256 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 48,892 KB |
最終ジャッジ日時 | 2024-04-14 12:41:33 |
合計ジャッジ時間 | 17,287 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 581 ms
44,144 KB |
testcase_01 | AC | 534 ms
44,276 KB |
testcase_02 | AC | 518 ms
44,616 KB |
testcase_03 | AC | 526 ms
44,652 KB |
testcase_04 | AC | 528 ms
44,148 KB |
testcase_05 | AC | 529 ms
44,428 KB |
testcase_06 | AC | 527 ms
44,148 KB |
testcase_07 | AC | 535 ms
44,024 KB |
testcase_08 | AC | 532 ms
44,012 KB |
testcase_09 | AC | 522 ms
44,336 KB |
testcase_10 | AC | 755 ms
45,808 KB |
testcase_11 | AC | 708 ms
47,300 KB |
testcase_12 | AC | 739 ms
46,964 KB |
testcase_13 | AC | 573 ms
45,940 KB |
testcase_14 | AC | 830 ms
48,892 KB |
testcase_15 | AC | 611 ms
44,372 KB |
testcase_16 | AC | 687 ms
45,164 KB |
testcase_17 | AC | 589 ms
46,320 KB |
testcase_18 | AC | 695 ms
43,896 KB |
testcase_19 | AC | 684 ms
47,732 KB |
ソースコード
import numpy as np N, M, K = list(map(int, input().split())) op, *B_list = input().split() B_array = np.array(list(map(int, B_list))) B_array.sort() if op == "+": count = 0 A_array = np.sort(np.array([int(input()) for i in range(N)]))[::-1] start = 0 m = 0 loop = True while loop: for n in range(start, N+1): if n == N or m == M: count += (n-start)*(M-m) loop = False break if B_array[m]+A_array[n] < K: if start == n: m += 1 break else: count += (n-start)*(M-m) start = n m += 1 break print(count) else: count = 0 A_array = np.sort(np.array([int(input()) for i in range(N)]))[::-1] start = 0 m = 0 loop = True while loop: for n in range(start, N+1): if n == N or m == M: count += (n-start)*(M-m) loop = False break if B_array[m]*A_array[n] < K: if start == n: m += 1 break else: count += (n-start)*(M-m) start = n m += 1 break print(count)