結果
問題 |
No.33 アメーバがたくさん
|
ユーザー |
![]() |
提出日時 | 2024-07-28 01:18:10 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 908 bytes |
コンパイル時間 | 1,883 ms |
コンパイル使用メモリ | 116,960 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-28 01:18:13 |
合計ジャッジ時間 | 2,316 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 1 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> using namespace std; using ll = long long; #include<map> int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll n,d,t; cin>>n>>d>>t; ll ans = 0; map<ll,vector<ll>> memo; for(int i = 0;i<n;i++){ ll x; cin>>x; ll now = x % d; if(now<0) now += d; memo[now].push_back(x); } for(auto&itr:memo){ auto now = itr.second; sort(now.begin(),now.end()); ll prev = -1e18; for(int i = 0;i<now.size();i++){ ll le = now[i] - d * t; ll ri = now[i] + d * t; if(prev<le){ ans += 2 * t + 1; prev = ri; continue; } le = prev; ll def = ri - le; ans += def / d; prev = ri; } } cout<<ans<<endl; }