結果
| 問題 |
No.3128 Isosceles Triangle
|
| コンテスト | |
| ユーザー |
テナガザル
|
| 提出日時 | 2025-04-25 21:46:53 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 397 ms / 2,500 ms |
| コード長 | 506 bytes |
| コンパイル時間 | 1,307 ms |
| コンパイル使用メモリ | 112,544 KB |
| 実行使用メモリ | 16,512 KB |
| 最終ジャッジ日時 | 2025-04-25 21:47:02 |
| 合計ジャッジ時間 | 6,936 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main()
{
int n;
cin >> n;
map<int, int> mp;
vector<int> a(n);
for (int i = 0; i < n; ++i)
{
cin >> a[i];
++mp[a[i]];
}
sort(a.begin(), a.end());
long long ans = 0;
for (auto [k, c] : mp)
{
auto id = lower_bound(a.begin(), a.end(), 2 * k) - a.begin();
ans += (long long)c * (c - 1) / 2 * (id - c);
}
cout << ans << endl;
}
テナガザル