結果

問題 No.3257 +|+
ユーザー karinohito
提出日時 2025-09-05 22:05:06
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 524 bytes
コンパイル時間 4,142 ms
コンパイル使用メモリ 285,304 KB
実行使用メモリ 271,616 KB
最終ジャッジ日時 2025-09-05 22:06:37
合計ジャッジ時間 22,482 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll =long long;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll N;
    cin>>N;
    ll MX=2e5*2;
    ll an=0;
    vector<unordered_map<ll,ll>> M(MX+1);
    for(ll i=1;i<=N;i++){
        ll A;
        cin>>A;
        for(ll k=1;k*i<=MX;k++){
            ll d=A-i*k;
            // cout<<k<<" "<<d<<endl;
            if(M[k].count(-d)){
                an+=M[k][-d];
            }
            M[k][d]++;
        }
    }    
    cout<<an<<"\n";
}  
0