結果

問題 No.989 N×Mマス計算(K以上)
ユーザー masa_ahemasa_ahe
提出日時 2020-02-15 00:06:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 797 bytes
コンパイル時間 1,497 ms
コンパイル使用メモリ 149,328 KB
実行使用メモリ 4,424 KB
最終ジャッジ日時 2023-07-28 19:04:28
合計ジャッジ時間 2,822 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 36 ms
4,376 KB
testcase_11 AC 34 ms
4,380 KB
testcase_12 AC 42 ms
4,380 KB
testcase_13 AC 23 ms
4,380 KB
testcase_14 AC 58 ms
4,424 KB
testcase_15 AC 16 ms
4,376 KB
testcase_16 AC 31 ms
4,380 KB
testcase_17 AC 21 ms
4,376 KB
testcase_18 AC 22 ms
4,376 KB
testcase_19 AC 35 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

int main(){
        ll n,m,k,tmp=0;
        cin>>n>>m>>k;
        ll sum1=0,sum2=0;
        vector<ll>a(n),b(m);
        char op;
        bool add=false;
        cin>>op;
        if(op=='+')add=true;
        for(int i=0;i<m;i++){
                cin>>b[i];
        }
        sort(b.begin(),b.end());
        for(int i=0;i<n;i++){
                cin>>a[i];
        }
        sort(a.begin(),a.end());
        for(int i=0;i<n;i++){
                if(add){
                                tmp+=b.end()-lower_bound(b.begin(),b.end(),k-a[i]);
                }else{
                                tmp+=b.end()-lower_bound(b.begin(),b.end(),(k+a[i]-1)/a[i]);
                }
        }
        cout<<tmp<<endl;
        return 0;
}
0