結果

問題 No.1623 三角形の制作
ユーザー chocoruskchocorusk
提出日時 2021-07-23 21:28:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 1,175 bytes
コンパイル時間 3,462 ms
コンパイル使用メモリ 187,036 KB
実行使用メモリ 5,988 KB
最終ジャッジ日時 2023-09-25 21:16:21
合計ジャッジ時間 6,370 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
4,384 KB
testcase_01 AC 13 ms
4,380 KB
testcase_02 AC 87 ms
5,116 KB
testcase_03 AC 83 ms
4,844 KB
testcase_04 AC 83 ms
4,776 KB
testcase_05 AC 140 ms
5,868 KB
testcase_06 AC 31 ms
4,380 KB
testcase_07 AC 83 ms
4,832 KB
testcase_08 AC 34 ms
4,384 KB
testcase_09 AC 78 ms
4,756 KB
testcase_10 AC 117 ms
5,712 KB
testcase_11 AC 95 ms
5,252 KB
testcase_12 AC 51 ms
4,376 KB
testcase_13 AC 61 ms
4,464 KB
testcase_14 AC 58 ms
4,404 KB
testcase_15 AC 127 ms
5,988 KB
testcase_16 AC 127 ms
5,808 KB
testcase_17 AC 127 ms
5,780 KB
testcase_18 AC 149 ms
5,880 KB
testcase_19 AC 60 ms
5,060 KB
testcase_20 AC 12 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
ll gc[3030], bc[3030], rc[6060], rs[6060];
int main()
{
    int n; cin>>n;
    int r[200020], g[200020], b[200020];
    for(int i=0; i<n; i++){
        cin>>r[i];
        rc[r[i]]++;
    }
    for(int i=0; i<n; i++){
        cin>>g[i];
        gc[g[i]]++;
    }
    for(int i=0; i<n; i++){
        cin>>b[i];
        bc[b[i]]++;
    }
    for(int i=1; i<=6000; i++) rs[i+1]=rs[i]+rc[i];
    ll ans=0;
    for(int i=1; i<=3000; i++){
        for(int j=1; j<=3000; j++){
            ans+=gc[i]*bc[j]*(rs[i+j]-rs[max(i, j)]);
        }
    }
    cout<<ans<<endl;
    return 0;
}
0