結果

問題 No.33 アメーバがたくさん
ユーザー hotpepsihotpepsi
提出日時 2015-05-15 01:07:17
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 688 bytes
コンパイル時間 593 ms
コンパイル使用メモリ 68,904 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 17:46:46
合計ジャッジ時間 1,077 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 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 <iostream>
#include <algorithm>
#include <sstream>
#include <set>

using namespace std;

typedef long long LL;
typedef set<LL> LLSet;

int main(int argc, char *argv[])
{
	LL N, D, T;
	string s;
	getline(cin, s);
	stringstream sa(s);
	sa >> N >> D >> T;
	getline(cin, s);
	stringstream sb(s);
	LLSet y;
	LL ans = (T * 2 + 1) * N;
	for (LL i = 0; i < N; ++i) {
		LL x;
		sb >> x;
		for (LL z : y) {
			LL a = min(x, z);
			LL b = max(x, z);
			LL c = ((a % D) + D) % D;
			LL d = ((b % D) + D) % D;
			if (c == d) {
				LL am = a + T * D;
				LL bn = b - T * D;
				if (am >= bn) {
					ans -= (am - bn + D) / D;
				}
			}
		}
		y.insert(x);
	}
	cout << ans << endl;
	return 0;
}
0