結果

問題 No.1623 三角形の制作
ユーザー rogi52rogi52
提出日時 2022-10-06 18:04:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 737 bytes
コンパイル時間 2,568 ms
コンパイル使用メモリ 197,948 KB
実行使用メモリ 5,272 KB
最終ジャッジ日時 2023-09-01 22:56:34
合計ジャッジ時間 6,723 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
4,380 KB
testcase_01 AC 11 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 25 ms
4,376 KB
testcase_13 AC 28 ms
4,376 KB
testcase_14 AC 28 ms
4,376 KB
testcase_15 AC 53 ms
4,380 KB
testcase_16 AC 53 ms
4,376 KB
testcase_17 AC 53 ms
4,380 KB
testcase_18 AC 58 ms
4,380 KB
testcase_19 AC 31 ms
4,376 KB
testcase_20 AC 11 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
#define int long long
    int MAX_L = 3000;
    int R[MAX_L + 1] = {}, G[MAX_L + 1] = {}, B[MAX_L + 1] = {};
    int n; cin >> n;
    rep(_,n) { int x; cin >> x; R[x]++; }
    rep(_,n) { int x; cin >> x; G[x]++; }
    rep(_,n) { int x; cin >> x; B[x]++; }

    int sumR[MAX_L + 2];
    rep(i,MAX_L+1) sumR[i + 1] += sumR[i] + R[i];

    // max(g,b) <= r < g+b
    int ans = 0;
    for(int g = 1; g <= MAX_L; g++) {
        for(int b = 1; b <= MAX_L; b++) {
            ans += (sumR[g + b] - sumR[max(g, b)]) * G[g] * B[b];
        }
    }
    cout << ans << endl;
}
0