結果
問題 | No.3049 Contest Coordinator |
ユーザー |
|
提出日時 | 2025-03-07 21:19:17 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 161 ms / 2,000 ms |
コード長 | 1,111 bytes |
コンパイル時間 | 3,932 ms |
コンパイル使用メモリ | 295,048 KB |
実行使用メモリ | 10,888 KB |
最終ジャッジ日時 | 2025-03-07 21:19:30 |
合計ジャッジ時間 | 12,102 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 58 |
ソースコード
// #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 debugbin(...) 42 #endif int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(ios::badbit | ios::failbit); int n, th, cx, cy; cin >> n >> th >> cx >> cy; vector<int> a(n); copy_n(istream_iterator<int>(cin), n, a.begin()); ranges::sort(a); vector<int> b; for(auto l = 0; l < n; ){ int r = l + 1; while(r < n && a[r] - a[r - 1] <= th){ ++ r; } b.push_back({r - l}); l = r; } ranges::sort(b | ranges::views::reverse); vector<long long> res(n + 1); for(auto sum = 0, i = 0; i < (int)b.size() - 1; ++ i){ sum += b[i]; res[sum + 1] += min(cx, cy); } for(auto i = 1; i <= n; ++ i){ res[i] += res[i - 1]; cout << res[i] << " "; } cout << "\n"; return 0; } /* */