結果
| 問題 | No.989 N×Mマス計算(K以上) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-25 18:21:38 |
| 言語 | Java (openjdk 27 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 694 ms / 2,000 ms |
| + 111µs | |
| コード長 | 1,071 bytes |
| 記録 | |
| コンパイル時間 | 1,913 ms |
| コンパイル使用メモリ | 99,504 KB |
| 実行使用メモリ | 116,424 KB |
| 最終ジャッジ日時 | 2026-10-15 17:18:52 |
| 合計ジャッジ時間 | 12,040 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
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();
Integer[] B=new Integer[M];
Integer[] A=new Integer[N];
for(int i=0;i<M;i++){
B[i]=sc.nextInt();
}
Arrays.sort(B,Collections.reverseOrder());
for(int i=0;i<N;i++){
A[i]=sc.nextInt();
}
Arrays.sort(A,Collections.reverseOrder());
long ANS=0;
int idxB=M-1;
if(str.equals("+")){
for(int j=0;j<N;j++){
while(idxB>=0&&B[idxB]+A[j]<K){
idxB--;
}
ANS+=idxB+1;
}
}else{
for(int j=0;j<N;j++){
while(idxB>=0&&B[idxB]*A[j]<K){
idxB--;
}
ANS+=idxB+1;
}
}
System.out.println(ANS);
}
}