結果
問題 | No.989 N×Mマス計算(K以上) |
ユーザー | Mishan5055 |
提出日時 | 2020-02-25 17:37:15 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,356 bytes |
コンパイル時間 | 2,147 ms |
コンパイル使用メモリ | 78,080 KB |
実行使用メモリ | 71,580 KB |
最終ジャッジ日時 | 2024-04-21 13:46:39 |
合計ジャッジ時間 | 11,408 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 138 ms
46,684 KB |
testcase_01 | AC | 140 ms
41,440 KB |
testcase_02 | AC | 148 ms
41,404 KB |
testcase_03 | AC | 154 ms
41,592 KB |
testcase_04 | AC | 145 ms
41,436 KB |
testcase_05 | AC | 147 ms
41,620 KB |
testcase_06 | AC | 146 ms
41,492 KB |
testcase_07 | AC | 143 ms
41,744 KB |
testcase_08 | AC | 147 ms
41,368 KB |
testcase_09 | AC | 149 ms
41,600 KB |
testcase_10 | AC | 1,388 ms
59,468 KB |
testcase_11 | AC | 1,310 ms
60,052 KB |
testcase_12 | TLE | - |
testcase_13 | AC | 974 ms
71,580 KB |
testcase_14 | TLE | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
ソースコード
import java.util.*; class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int N=sc.nextInt(); int M=sc.nextInt(); int K=sc.nextInt(); String str=sc.next(); PriorityQueue<Integer> pq=new PriorityQueue<>(); int[] B=new int[M]; int[] Binv=new int[M]; for(int i=0;i<M;i++){ pq.add(sc.nextInt()); } long ANS=0L; if(str.equals("+")){ for(int i=0;i<M;i++){ B[M-1-i]=pq.poll(); Binv[M-1-i]=K-B[M-1-i]; } for(int i=0;i<N;i++){ int A=sc.nextInt(); for(int j=0;j<M;j++){ if(A<Binv[j]){ break; } ANS++; } } }else{ for(int i=0;i<M;i++){ B[M-1-i]=pq.poll(); Binv[M-1-i]=(K+B[M-1-i]-1)/B[M-1-i]; } for(int i=0;i<N;i++){ int A=sc.nextInt(); for(int j=0;j<M;j++){ if(A<Binv[j]){ break; } ANS++; } } } System.out.println(ANS); } }