結果

問題 No.1623 三角形の制作
ユーザー chocorusk
提出日時 2021-07-23 21:28:53
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 175 ms / 2,000 ms
コード長 1,175 bytes
コンパイル時間 3,155 ms
コンパイル使用メモリ 180,536 KB
最終ジャッジ日時 2025-01-23 07:47:57
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

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