結果

問題 No.1623 三角形の制作
ユーザー erbowlerbowl
提出日時 2022-09-02 07:19:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,173 bytes
コンパイル時間 2,164 ms
コンパイル使用メモリ 214,864 KB
実行使用メモリ 158,920 KB
最終ジャッジ日時 2024-04-27 10:46:02
合計ジャッジ時間 8,970 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n;
    std::cin >> n;
    map<ll,ll> cnt1,cnt2,cnt3;
    for (int i = 0; i < n; i++) {
        ll a;
        std::cin >> a;
        cnt1[a]++;
    }
    for (int i = 0; i < n; i++) {
        ll a;
        std::cin >> a;
        cnt2[a]++;
    }
    for (int i = 0; i < n; i++) {
        ll a;
        std::cin >> a;
        cnt3[a]++;
    }
    vector<vector<ll>> dp(6001,vector<ll>(3001));
    for (int i = 0; i <= 6000; i++) {
        for (int j = 0; j <= i; j++) {
            dp[i][max(j,i-j)] += cnt2[i-j]*cnt3[j];
        }
    }
    vector<ll> ruic(3001);
    for (int i = 1; i <= 3000; i++) {
        ruic[i] = ruic[i-1]+cnt1[i];
    }
    ll ans = 0;
    for (int i = 0; i <= 6000; i++) {
        for (int j = 0; j <= i; j++) {
            ans += max(0ll,(ruic[i-1]-ruic[j-1]))*dp[i][j];
            // if((ruic[i-1]-ruic[j-1]>0*dp[i][j]>0){
            //     std::cout << i<<" "<<j<<" "<<ans << std::endl;
            // }
        }
    }
    std::cout << ans << std::endl;
}
0