結果

問題 No.33 アメーバがたくさん
ユーザー たこしたこし
提出日時 2014-11-16 17:51:19
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,033 bytes
コンパイル時間 835 ms
コンパイル使用メモリ 90,936 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 17:41:50
合計ジャッジ時間 1,384 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <queue>

#define INF 100000000
#define EPS 1e-9

using namespace std;

typedef pair<int, int> P;
typedef long long ll;

#define MAX_N 100

int N, D, T;
int x[MAX_N];

ll ans = 0;


int main() {

	cin >> N >> D >> T;
	for (int i = 0; i < N; i++){
		cin >> x[i];
	}

	ll ans = N * (1 + 2 * T);

	sort(x, x + N);

	for (int i = 0; i < N; i++){
		for (int j = i + 1; j < N; j++){
			if (abs(x[i] - x[j]) % D == 0){
				ll tmp = (x[i] + D*T) - (x[j] - D*T);
				if (tmp < 0)
					continue;
				ans -= tmp / D + 1;
			}
		}
	}

	cout << ans << endl;

	return 0;
}
0