結果
問題 |
No.1882 Areas of Triangle
|
ユーザー |
|
提出日時 | 2022-04-03 22:01:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 49 ms / 2,000 ms |
コード長 | 372 bytes |
コンパイル時間 | 1,852 ms |
コンパイル使用メモリ | 194,332 KB |
最終ジャッジ日時 | 2025-01-28 14:50:53 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> using namespace std; long long n, k, m; long long a[100001]; int main() { cin >> n >> k; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); long long j = n - 1; for (int i = 0; i < n; i++) { if (a[i] * a[j] >= k * 2) { while (j > 0 && a[i] * a[j - 1] >= k * 2) { j--; } m += n - j; } } cout << m << endl; }