結果

問題 No.989 N×Mマス計算(K以上)
ユーザー glretoglreto
提出日時 2021-01-02 19:51:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,030 bytes
コンパイル時間 1,748 ms
コンパイル使用メモリ 170,104 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-20 14:25:38
合計ジャッジ時間 3,002 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits//stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
#define rrep(i,n) for(ll i = n-1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
#define RALL(a) rbegin(a),rend(a)
typedef long long ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;
ll mod = 1e9+7;
int main(){
   ll n,m,k;char c;cin >>n>>m>>k>>c;
   vector<ll> a(n),b(m);
   rep(i,m) cin >> b[i];
   rep(i,n)cin >> a[i];
   sort(ALL(a));sort(ALL(b));
   int ans = 0;
   if(c=='+'){
       rep(i,n) ans += b.end()-lower_bound(ALL(b),k-a[i]);
   }else {
       rep(i,n) {
           int ok = 0,ng = m-1;
           while(ng-ok>1){
               int mid=(ok+ng)/2;
               if(a[i]*b[mid] < k) ok = mid;
               else ng = mid;
           }ans += m-ng;
       }
   }cout << ans << endl;
}
0