結果

問題 No.989 N×Mマス計算(K以上)
コンテスト
ユーザー Mishan5055
提出日時 2020-02-25 17:37:15
言語 Java
(openjdk 27 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,356 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,583 ms
コンパイル使用メモリ 97,468 KB
実行使用メモリ 119,944 KB
最終ジャッジ日時 2026-10-15 17:18:58
合計ジャッジ時間 17,894 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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);
    }
}
0