結果

問題 No.1882 Areas of Triangle
ユーザー mmn15277198mmn15277198
提出日時 2022-03-24 21:38:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 686 bytes
コンパイル時間 1,014 ms
コンパイル使用メモリ 100,616 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-21 06:41:15
合計ジャッジ時間 2,078 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 WA -
testcase_04 AC 49 ms
6,940 KB
testcase_05 AC 56 ms
6,940 KB
testcase_06 WA -
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 WA -
testcase_11 AC 2 ms
6,948 KB
testcase_12 AC 1 ms
6,944 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 3 ms
6,944 KB
testcase_19 AC 6 ms
6,940 KB
testcase_20 AC 7 ms
6,940 KB
testcase_21 WA -
testcase_22 AC 6 ms
6,944 KB
testcase_23 AC 17 ms
6,944 KB
testcase_24 AC 18 ms
6,940 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 AC 1 ms
6,940 KB
testcase_27 AC 1 ms
6,940 KB
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
#include <cstdio>
#include <string>

using namespace std;

int main() {
  int n;
  long long k;
  cin >> n >> k;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int ok = n;
    int ng = 0;
    while (ok - ng > 1) {
      int mid = (ok + ng) / 2;
      if (a[i] * a[mid] >= 2 * k) {
        ok = mid;
      } else {
        ng = mid;
      }
    }
    ans += n - ok;
  }
  cout << ans << endl;
  return 0;
}
0