結果
| 問題 |
No.33 アメーバがたくさん
|
| コンテスト | |
| ユーザー |
hotpepsi
|
| 提出日時 | 2015-05-15 01:22:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 818 bytes |
| コンパイル時間 | 681 ms |
| コンパイル使用メモリ | 69,760 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-24 10:09:34 |
| 合計ジャッジ時間 | 1,179 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 8 WA * 3 |
ソースコード
#include <iostream>
#include <algorithm>
#include <sstream>
#include <set>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> LLLL;
typedef set<LLLL> LLLLSet;
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);
LLLLSet y;
LL ans = (T * 2 + 1) * N;
for (LL i = 0; i < N; ++i) {
LL x;
sb >> x;
LL a = x - D * T, b = x + D * T;
LL c = ((a % D) + D) % D;
for (LLLL r : y) {
LL d = r.first;
LL e = r.second;
LL f = ((d % D) + D) % D;
if (c == f) {
if (a >= d && a <= e) {
ans -= (e - a + D) / D;
a = e + D;
}
if (b >= d && b <= e) {
ans -= (d - b + D) / D;
b = d - D;
}
}
}
y.insert(LLLL(a, b));
}
cout << ans << endl;
return 0;
}
hotpepsi