結果
| 問題 |
No.3128 Isosceles Triangle
|
| コンテスト | |
| ユーザー |
rgnerdplayer
|
| 提出日時 | 2025-05-01 16:00:16 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 67 ms / 2,500 ms |
| コード長 | 679 bytes |
| コンパイル時間 | 3,222 ms |
| コンパイル使用メモリ | 278,412 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-05-01 16:00:23 |
| 合計ジャッジ時間 | 6,390 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
auto solve = [&]() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a.begin(), a.end());
i64 ans = 0;
for (int i = 0, j = 0; i < n; i = j) {
while (j < n && a[i] == a[j]) {
j++;
}
ans += 1LL * (j - i) * (j - i - 1) / 2 * (lower_bound(a.begin(), a.end(), 2 * a[i]) - a.begin() - (j - i));
}
cout << ans << '\n';
};
solve();
return 0;
}
rgnerdplayer