結果

問題 No.1623 三角形の制作
ユーザー umezoumezo
提出日時 2021-07-24 03:55:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 656 bytes
コンパイル時間 2,298 ms
コンパイル使用メモリ 201,528 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-26 09:30:21
合計ジャッジ時間 4,671 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
4,384 KB
testcase_01 AC 18 ms
4,380 KB
testcase_02 AC 44 ms
4,380 KB
testcase_03 AC 43 ms
4,384 KB
testcase_04 AC 43 ms
4,384 KB
testcase_05 AC 63 ms
4,384 KB
testcase_06 AC 24 ms
4,384 KB
testcase_07 AC 42 ms
4,380 KB
testcase_08 AC 26 ms
4,380 KB
testcase_09 AC 41 ms
4,384 KB
testcase_10 AC 55 ms
4,380 KB
testcase_11 AC 47 ms
4,380 KB
testcase_12 AC 31 ms
4,384 KB
testcase_13 AC 35 ms
4,384 KB
testcase_14 AC 34 ms
4,384 KB
testcase_15 AC 58 ms
4,384 KB
testcase_16 AC 58 ms
4,380 KB
testcase_17 AC 58 ms
4,380 KB
testcase_18 AC 63 ms
4,380 KB
testcase_19 AC 37 ms
4,380 KB
testcase_20 AC 18 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n;
  cin>>n;
  vector<ll> R(6030),G(3030),B(3030);
  rep(i,n){
    int r;
    cin>>r;
    R[r]++;
  }
  rep(i,n){
    int g;
    cin>>g;
    G[g]++;
  }
  rep(i,n){
    int b;
    cin>>b;
    B[b]++;
  }
    
  vector<ll> S(6030);
  for(int i=1;i<=6000;i++) S[i]=S[i-1]+R[i];
    
  ll ans=0;
  for(int j=1;j<=3000;j++){
    for(int k=1;k<=3000;k++) ans+=G[j]*B[k]*(S[j+k-1]-S[max(j,k)-1]);
  }
  cout<<ans<<endl;
  
  return 0;
}
0