結果
問題 |
No.3128 Isosceles Triangle
|
ユーザー |
![]() |
提出日時 | 2025-04-25 22:15:57 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 201 ms / 2,500 ms |
コード長 | 1,910 bytes |
コンパイル時間 | 3,806 ms |
コンパイル使用メモリ | 284,148 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-04-25 22:16:06 |
合計ジャッジ時間 | 7,838 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> //#include <atcoder/all> using namespace std; //using namespace atcoder; using lli=long long int; using ld=long double; using vi=vector<int>; using vvi=vector<vi>; using vvvi=vector<vvi>; using vvvvi=vector<vvvi>; using vl=vector<lli>; using vvl=vector<vl>; #define rep(i,s,e) for(int i=s;i<e;i++) #define rrep(i,s,e) for(int i=s-1;i>=e;i--) #define in(v,tem) for(auto v:tem) #define veci(v,s) vi v(s); rep(i,0,s) cin >> v.at(i); #define vecl(v,s) vl v(s); rep(i,0,s) cin >> v.at(i); #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() using pii=pair<int,int>; using pll=pair<lli,lli>; #define mp(f,s) make_pair(f,s) #define fi first #define se second using vpii=vector<pii>; using vpll=vector<pll>; #define vecpii(v,s) vpii v(s); rep(i,0,s) cin >> v.at(i).fi >> v.at(i).se; #define vecpll(v,s) vpll v(s); rep(i,0,s) cin >> v.at(i).fi >> v.at(i).se; #define pub(x) push_back(x) #define puf(x) push_front(x) #define pob(x) pop_back(x) #define pof(x) pop_front(x) #define eb(x) emplace_back(x) #define print(s) cout << s << endl; const int I_INF=1<<30; const lli LL_INF=1ll<<60; const string alp="abcdefghijklmnopqrstuvwxyz"; const int let=alp.size(); // 26 template<typename T> inline vector<T> cood_comp(vector<T> &seq){ vector<T> ret=seq; sort(seq.begin(),seq.end()); seq.erase(unique(seq.begin(),seq.end()),seq.end()); for(int i=0;i<(int)ret.size();i++){ ret.at(i)=lower_bound(seq.begin(),seq.end(),ret.at(i))-seq.begin(); } return ret; } int main(){ int n; cin >> n; veci(a,n); vi c=cood_comp(a); vl imos(a.size(),0); rep(i,0,n) imos[c[i]]++; rep(i,1,a.size()) imos[i]+=imos[i-1]; lli ans=0; rep(i,0,a.size()){ lli eq=(i==0 ? imos[i]:imos[i]-imos[i-1]); if(eq<2) continue; int ind=lower_bound(all(a),a[i]*2)-a.begin()-1; if(ind<0) continue; lli neq=imos[ind]-eq; ans+=eq*(eq-1)/2*neq; } print(ans); }