結果
| 問題 |
No.3128 Isosceles Triangle
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-25 22:07:27 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 392 ms / 2,500 ms |
| コード長 | 459 bytes |
| コンパイル時間 | 3,427 ms |
| コンパイル使用メモリ | 286,852 KB |
| 実行使用メモリ | 21,760 KB |
| 最終ジャッジ日時 | 2025-04-25 22:07:39 |
| 合計ジャッジ時間 | 9,191 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/fenwicktree>
using namespace std;
#define int long long
int comb(int a){return (a*(a-1))/2;}
signed main(){
int n;cin>>n;
map<int,int>edge;
vector<int>a(n);
for(int i=0;i<n;i++)cin>>a[i];
for(int i:a)edge[i]++;
sort(a.begin(),a.end());
int ans=0;
for(auto[i,j]:edge){
int rt=lower_bound(a.begin(),a.end(),2*i)-a.begin();
ans+=comb(j)*(rt-j);
}
cout<<ans<<endl;
}