結果
問題 |
No.33 アメーバがたくさん
|
ユーザー |
![]() |
提出日時 | 2015-05-15 01:29:05 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 787 bytes |
コンパイル時間 | 581 ms |
コンパイル使用メモリ | 69,864 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-24 10:09:51 |
合計ジャッジ時間 | 1,107 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 6 |
ソースコード
#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; } else if (b >= d && b <= e) { ans -= (d - b + D) / D; } } } y.insert(LLLL(a, b)); } cout << ans << endl; return 0; }