結果
| 問題 | No.3257 +|+ | 
| コンテスト | |
| ユーザー |  Iroha_3856 | 
| 提出日時 | 2025-09-03 15:31:45 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 559 bytes | 
| コンパイル時間 | 3,338 ms | 
| コンパイル使用メモリ | 287,980 KB | 
| 実行使用メモリ | 45,124 KB | 
| 最終ジャッジ日時 | 2025-09-05 15:02:43 | 
| 合計ジャッジ時間 | 14,109 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 RE * 24 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N; cin >> N;
    int M = 200'000;
    int A[N+1];
    for (int i = 1; i <= N; i++) cin >> A[i];
    
    vector<vector<int>> C(M+1);
    for (int i = 1; i <= N; i++) {
        for (int d = 1; d <= (A[i] + M) / i; d++) {
          C[d].push_back(A[i] - d * i);
        }
    }
    
    long long ans = 0;
    
    for (int d = 1; d <= M; d++) {
        map<int, int> cnt;
        for (int x : C[d]) {
        	ans += cnt[-x];
        	cnt[x]++;
        }
    }
    
    cout << ans << endl;
}
            
            
            
        