結果
問題 |
No.33 アメーバがたくさん
|
ユーザー |
![]() |
提出日時 | 2022-07-08 14:22:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 951 bytes |
コンパイル時間 | 3,169 ms |
コンパイル使用メモリ | 223,056 KB |
最終ジャッジ日時 | 2025-01-30 05:15:37 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#pragma region template #pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; #ifdef __LOCAL #include <debug> #else #define debug(...) void(0) #endif #define REP(i,n) for(int i=0;i<(n);i++) #define ALL(v) v.begin(),v.end() template<typename T> istream& operator>>(istream&is,vector<T>&v){ for(T&p:v)is>>p; return is; } template<typename T> ostream& operator<<(ostream&os,const vector<T>&v){ if(&os==&cerr)os<<"["; for(int i=0;i<v.size();i++){ os<<v[i]; if(i+1<v.size())os<<(&os==&cerr?",":" "); } if(&os==&cerr)os<<"]"; return os; } #pragma endregion template using ll=long long; const int INF=1e9+7; int main(){ int n,d,t;cin>>n>>d>>t; map<int,vector<ll>> mp; REP(_,n){ ll x;cin>>x;x+=INF; mp[x%d].push_back(x/d); } ll ans=0; for(auto&[id,ve]:mp){ sort(ALL(ve)); ll pre=-INF; for(ll p:ve){ ans+=p+t-max(pre+1,p-t)+1; pre=p+t; } } cout<<ans<<endl; }