結果
問題 | No.989 N×Mマス計算(K以上) |
ユーザー | nehan_der_thal |
提出日時 | 2020-02-14 22:15:18 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 152 ms / 2,000 ms |
コード長 | 708 bytes |
コンパイル時間 | 270 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 92,288 KB |
最終ジャッジ日時 | 2024-04-16 02:26:50 |
合計ジャッジ時間 | 2,620 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
52,208 KB |
testcase_01 | AC | 40 ms
51,840 KB |
testcase_02 | AC | 41 ms
51,968 KB |
testcase_03 | AC | 40 ms
52,224 KB |
testcase_04 | AC | 40 ms
52,096 KB |
testcase_05 | AC | 41 ms
52,224 KB |
testcase_06 | AC | 40 ms
51,712 KB |
testcase_07 | AC | 40 ms
52,480 KB |
testcase_08 | AC | 41 ms
52,224 KB |
testcase_09 | AC | 41 ms
52,352 KB |
testcase_10 | AC | 128 ms
85,128 KB |
testcase_11 | AC | 117 ms
90,368 KB |
testcase_12 | AC | 129 ms
88,192 KB |
testcase_13 | AC | 99 ms
86,304 KB |
testcase_14 | AC | 152 ms
92,288 KB |
testcase_15 | AC | 95 ms
78,208 KB |
testcase_16 | AC | 112 ms
82,000 KB |
testcase_17 | AC | 101 ms
86,528 KB |
testcase_18 | AC | 109 ms
79,744 KB |
testcase_19 | AC | 121 ms
90,496 KB |
ソースコード
N, M, K = map(int, input().split()) bs = [] fs = [] for i in range(N+1): if i == 0: X = input().split() e = X[0] == '+' bs = list(map(int, X[1:])) bs.sort() continue x = int(input()) fs.append(x) fs.sort() if e: j = N-1 r = 0 for b in bs: k = K-b # print(j) while j >= 0: # print(j, fs[j], k) if fs[j] < k: break j -= 1 # print(k, fs, N-(j+1)) r += N-j-1 print(r) else: j = N-1 r = 0 for b in bs: k = -(-K//b) while j >= 0: if fs[j] < k: break j -= 1 r += N-j-1 print(r)