結果
問題 |
No.3257 +|+
|
ユーザー |
|
提出日時 | 2025-09-05 22:17:48 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 792 ms / 3,000 ms |
コード長 | 612 bytes |
コンパイル時間 | 3,720 ms |
コンパイル使用メモリ | 323,216 KB |
実行使用メモリ | 13,444 KB |
最終ジャッジ日時 | 2025-09-05 22:18:12 |
合計ジャッジ時間 | 23,235 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll =long long; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); ll N; cin>>N; int MX=0; ll an=0; vector<int> D(N); for(int i=0;i<N;i++){ cin>>D[i]; MX=max(MX,D[i]); } MX+=MX; for(ll k=1;k<=MX;k++){ unordered_map<ll,ll> M; for(ll i=1;i*k<=MX;i++){ if(i>N)break; ll d=D[i-1]-i*k; if(M.count(-d))an+=M[-d]; M[d]++; } } cout<<an<<"\n"; }