結果

問題 No.989 N×Mマス計算(K以上)
ユーザー zekezeke
提出日時 2020-05-06 15:02:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 1,783 bytes
コンパイル時間 858 ms
コンパイル使用メモリ 99,476 KB
実行使用メモリ 4,556 KB
最終ジャッジ日時 2023-09-11 01:56:06
合計ジャッジ時間 2,198 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 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 20 ms
4,376 KB
testcase_11 AC 19 ms
4,380 KB
testcase_12 AC 23 ms
4,376 KB
testcase_13 AC 12 ms
4,376 KB
testcase_14 AC 32 ms
4,556 KB
testcase_15 AC 9 ms
4,376 KB
testcase_16 AC 17 ms
4,380 KB
testcase_17 AC 11 ms
4,376 KB
testcase_18 AC 12 ms
4,376 KB
testcase_19 AC 19 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
    Author:zeke

    pass System Test!
    GET AC!!
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
// cout << "Case #" << index << " :IMPOSSIBLE";
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    ll n,m,k;
    cin>>n>>m>>k;
    char c;
    cin>>c;
    V b(m);
    rep(i,m)cin>>b[i];
    V a(n);
    rep(i,n)cin>>a[i];
    sort(all(a));
    sort(all(b));
    
    ll res=0;
    rep(i,n){
        ll f;
        if(c=='+'){
            f=lower_bound(all(b),k-a[i])-b.begin();
        }else{
            f=lower_bound(all(b),(k+a[i]-1)/a[i])-b.begin();
        }
        f=m-f;
        res+=f;
    }
    cout<<res<<endl;
    
}
0