結果
| 問題 |
No.33 アメーバがたくさん
|
| コンテスト | |
| ユーザー |
hotpepsi
|
| 提出日時 | 2015-05-15 01:46:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 746 bytes |
| コンパイル時間 | 539 ms |
| コンパイル使用メモリ | 69,308 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-24 10:09:56 |
| 合計ジャッジ時間 | 1,078 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
#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 z;
LL ans = 0;
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 (LL y : z) {
LL d = y - D * T, e = y + D * T;
LL f = ((d % D) + D) % D;
if (c == f) {
if (a >= d && a <= e) {
a = e + D;
}
if (b >= d && b <= e) {
b = d - D;
}
}
}
z.insert(x);
if (b >= a) {
ans += (b - a + D) / D;
}
}
cout << ans << endl;
return 0;
}
hotpepsi