結果
| 問題 | No.3456 Common Difference is D |
| コンテスト | |
| ユーザー |
ripity
|
| 提出日時 | 2026-03-19 21:48:24 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 285 ms / 2,000 ms |
| コード長 | 455 bytes |
| 記録 | |
| コンパイル時間 | 4,771 ms |
| コンパイル使用メモリ | 381,900 KB |
| 実行使用メモリ | 34,688 KB |
| 最終ジャッジ日時 | 2026-03-19 21:48:33 |
| 合計ジャッジ時間 | 7,427 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using ll = long long;
int main() {
int N, D;
cin >> N >> D;
vector<map<int, ll>> mp(3);
while(N--) {
int x;
cin >> x;
mp[2][x] += mp[1][x - D];
mp[1][x] += mp[0][x - D];
mp[0][x] += 1;
}
ll ans = 0;
for(auto [_, v] : mp[2]) ans += v;
cout << ans << endl;
}
ripity