結果
| 問題 | No.3128 Isosceles Triangle |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-04-28 20:23:51 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 188 ms / 2,500 ms |
| コード長 | 538 bytes |
| 記録 | |
| コンパイル時間 | 1,237 ms |
| コンパイル使用メモリ | 221,716 KB |
| 実行使用メモリ | 16,800 KB |
| 最終ジャッジ日時 | 2026-07-10 09:24:56 |
| 合計ジャッジ時間 | 4,705 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3fLL;
const int MAX=1e7+10;
int main()
{
int n,i,x;
ll ans,cnt;
scanf("%d",&n);
map<int,int> mp;
vector<int> res;
for(i=1;i<=n;i++)
{
scanf("%d",&x);
mp[x]++;
res.push_back(x);
}
sort(res.begin(),res.end());
ans=0;
for(auto &it:mp)
{
cnt=lower_bound(res.begin(),res.end(),it.first*2)-res.begin();
cnt-=it.second;
ans+=cnt*(it.second*(it.second-1)/2);
}
printf("%lld\n",ans);
return 0;
}
vjudge1