結果
問題 | No.3049 Contest Coordinator |
ユーザー |
|
提出日時 | 2025-03-07 23:18:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 163 ms / 2,000 ms |
コード長 | 1,021 bytes |
コンパイル時間 | 2,580 ms |
コンパイル使用メモリ | 204,052 KB |
実行使用メモリ | 9,260 KB |
最終ジャッジ日時 | 2025-03-07 23:18:51 |
合計ジャッジ時間 | 10,154 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 58 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;} template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;} void Solve(){ int N; ll T,X,Y; cin>>N>>T>>X>>Y; vector<ll>D(N); for(int i=0;i<N;i++)cin>>D[i]; sort(all(D)); int l=0; vector<int>V; while(l<N){ int r=l; while(r+1<N&&D[r+1]-D[r]<=T){ r++; } V.push_back(r-l+1); l=r+1; } sort(all(V)); ll ans=0; bool flag=true; for(int i=0;i<N;i++){ if(!flag){ ans+=min(X,Y); flag=true; } V.back()--; if(V.back()==0){ flag=false; V.pop_back(); } cout<<ans<<" "; } cout<<"\n"; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); Solve(); }