結果
| 問題 |
No.33 アメーバがたくさん
|
| コンテスト | |
| ユーザー |
srjywrdnprkt
|
| 提出日時 | 2022-12-19 22:55:19 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 755 bytes |
| コンパイル時間 | 1,598 ms |
| コンパイル使用メモリ | 148,972 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-18 01:26:29 |
| 合計ジャッジ時間 | 1,961 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
using namespace std;
int main(){
long long N, D, T, X, ans=0;
cin >> N >> D >> T;
map<long long, vector<long long>> mp;
for (int i=0; i<N; i++){
cin >> X;
mp[(X%D+D)%D].push_back(X);
}
for (auto &[x, y] : mp) sort(y.begin(), y.end());
for (auto [x, y] : mp){
ans += T * 2 + y.size();
if (y.size() == 1) continue;
for (int i=0; i<y.size()-1; i++){
long long Z = (y[i+1]-y[i])/D-1;
ans += min(Z, T * 2);
}
}
cout << ans << endl;
return 0;
}
srjywrdnprkt