結果
| 問題 | No.989 N×Mマス計算(K以上) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-25 17:37:15 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 1,861 ms / 2,000 ms |
| コード長 | 1,356 bytes |
| 記録 | |
| コンパイル時間 | 2,645 ms |
| コンパイル使用メモリ | 83,804 KB |
| 実行使用メモリ | 61,636 KB |
| 最終ジャッジ日時 | 2026-04-30 22:14:43 |
| 合計ジャッジ時間 | 12,998 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
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);
}
}