結果

問題 No.989 N×Mマス計算(K以上)
ユーザー outlineoutline
提出日時 2020-03-05 16:42:33
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 1,493 bytes
コンパイル時間 1,102 ms
コンパイル使用メモリ 115,456 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 02:37:16
合計ジャッジ時間 2,064 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 16 ms
5,376 KB
testcase_11 AC 17 ms
5,376 KB
testcase_12 AC 20 ms
5,376 KB
testcase_13 AC 12 ms
5,376 KB
testcase_14 AC 27 ms
5,376 KB
testcase_15 AC 7 ms
5,376 KB
testcase_16 AC 13 ms
5,376 KB
testcase_17 AC 10 ms
5,376 KB
testcase_18 AC 9 ms
5,376 KB
testcase_19 AC 17 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const int mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m;
    ll k;
    char op;
    cin >> n >> m >> k >> op;
    vector<ll> b(m);
    for(int i = 0; i < m; ++i)  cin >> b[i];
    vector<ll> a(n);
    for(int i = 0; i < n; ++i)  cin >> a[i];

    sort(b.begin(), b.end());
    ll res = 0;
    if(op == '+'){
        for(int i = 0; i < n; ++i){
            res += b.end() - lower_bound(b.begin(), b.end(), k - a[i]);
        }
    }
    else{
        for(int i = 0; i < n; ++i){
            ll comparision = ceil((double)k / a[i]);
            res += b.end() - lower_bound(b.begin(), b.end(), comparision);
        }
    }
    cout << res << endl;
}
0