結果

問題 No.33 アメーバがたくさん
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2022-12-19 22:49:22
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 750 bytes
コンパイル時間 1,487 ms
コンパイル使用メモリ 147,692 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-29 02:33:36
合計ジャッジ時間 1,998 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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<N-1; i++){
            long long Z = (y[i+1] - y[i])/D -1;
            ans += min(Z, T * 2);
        }
    }

    cout << ans << endl;

    return 0;
}
0