結果

問題 No.1623 三角形の制作
ユーザー kappybarkappybar
提出日時 2021-07-31 20:23:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 979 bytes
コンパイル時間 1,721 ms
コンパイル使用メモリ 166,528 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-10-14 15:09:43
合計ジャッジ時間 4,809 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,368 KB
testcase_01 AC 5 ms
4,372 KB
testcase_02 AC 71 ms
4,372 KB
testcase_03 AC 70 ms
4,372 KB
testcase_04 AC 69 ms
4,368 KB
testcase_05 AC 120 ms
4,372 KB
testcase_06 AC 21 ms
4,368 KB
testcase_07 AC 67 ms
4,372 KB
testcase_08 AC 25 ms
4,372 KB
testcase_09 AC 61 ms
4,368 KB
testcase_10 AC 103 ms
4,368 KB
testcase_11 AC 80 ms
4,368 KB
testcase_12 AC 39 ms
4,372 KB
testcase_13 AC 47 ms
4,372 KB
testcase_14 AC 47 ms
4,372 KB
testcase_15 AC 104 ms
4,376 KB
testcase_16 AC 105 ms
4,376 KB
testcase_17 AC 110 ms
4,372 KB
testcase_18 AC 132 ms
4,372 KB
testcase_19 AC 46 ms
4,368 KB
testcase_20 AC 5 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define chmin(x,y) x = min((x),(y))
#define chmax(x,y) x = max((x),(y))
#define popcount(x) __builtin_popcount(x)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
const int INF = 1e9;
const long long LINF = 1e17;
const int MOD = 1000000007;
//const int MOD = 998244353;
const double PI = 3.14159265358979323846;

int main(){
    int n;
    cin >> n;
    vector<ll> r(3005,0),b(3005,0),g(3005,0);

    rep(i,n){
        int rr;
        cin >> rr;
        r[rr] ++;
    }
    rep(i,n){
        int gg;
        cin >> gg;
        g[gg] ++;
    }
    rep(i,n){
        int bb;
        cin >> bb;
        b[bb] ++;
    }
    rep(i,3004) b[i+1] += b[i];

    ll ans = 0;
    for(int i=0;i<3005;i++){
        for(int j=0;j<=i;j++){
            int c = i-j;
            ans += (b[i]-b[c])*r[i]*g[j];
        }
    }
    cout << ans << endl;

    return 0;
}
0