結果
| 問題 |
No.3128 Isosceles Triangle
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-25 21:42:35 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 70 ms / 2,500 ms |
| コード長 | 999 bytes |
| コンパイル時間 | 3,777 ms |
| コンパイル使用メモリ | 290,824 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-04-25 21:42:57 |
| 合計ジャッジ時間 | 6,461 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
// #include <bits/allocator.h> // Temp fix for gcc13 global pragma
// #pragma GCC target("avx2,bmi2,popcnt,lzcnt")
// #pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
// #include <x86intrin.h>
using namespace std;
#if __cplusplus >= 202002L
using namespace numbers;
#endif
#ifdef LOCAL
#include "Debug.h"
#else
#define debug_endl() 42
#define debug(...) 42
#define debug2(...) 42
#define debug_bin(...) 42
#endif
int main(){
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(ios::badbit | ios::failbit);
int n;
cin >> n;
vector<int> a(n);
copy_n(istream_iterator<int>(cin), n, a.begin());
ranges::sort(a | ranges::views::reverse);
int64_t res = 0;
for(auto i = 0; auto chunk: a | ranges::views::chunk_by(equal_to<>())){
if((int)chunk.size() == 1){
continue;
}
int x = *chunk.begin();
while(a[i] >= 2 * x){
++ i;
}
res += 1LL * (int)chunk.size() * ((int)chunk.size() - 1) / 2 * (n - i - (int)chunk.size());
}
cout << res << "\n";
return 0;
}
/*
*/