結果
| 問題 | 
                            No.2046 Ans Mod? Mod Ans!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-07-18 22:13:36 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 524 bytes | 
| コンパイル時間 | 1,963 ms | 
| コンパイル使用メモリ | 198,064 KB | 
| 最終ジャッジ日時 | 2025-01-23 03:12:33 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 10 TLE * 8 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n, 0);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            ans += abs(a[i] % a[j] - a[j] % a[i]);
        }
    }
    cout << ans << endl;
}