結果
問題 |
No.1882 Areas of Triangle
|
ユーザー |
![]() |
提出日時 | 2022-03-23 21:54:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 23 ms / 2,000 ms |
コード長 | 613 bytes |
コンパイル時間 | 486 ms |
コンパイル使用メモリ | 44,740 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 00:49:06 |
合計ジャッジ時間 | 1,874 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 24 |
ソースコード
/* -*- coding: utf-8 -*- * * 1882.cc: No.1882 Areas of Triangle - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ const int MAX_N = 100000; /* typedef */ typedef long long ll; /* global variables */ int as[MAX_N]; /* subroutines */ /* main */ int main() { int n; ll k; scanf("%d%lld", &n, &k); for (int i = 0; i < n; i++) scanf("%d", as + i); ll k2 = k * 2; sort(as, as + n); ll sum = 0; for (int i = 0, j = 0; i < n; i++) { while (j < n && (ll)as[i] * as[n - 1 - j] >= k2) j++; sum += j; } printf("%lld\n", sum); return 0; }