結果

問題 No.1623 三角形の制作
ユーザー Nzt3Nzt3
提出日時 2022-10-11 02:31:43
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 520 bytes
コンパイル時間 2,155 ms
コンパイル使用メモリ 200,532 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-07 05:16:49
合計ジャッジ時間 5,887 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin>>N;
  vector<long long>A(3001),B(3001),C(3001);
  for(int i=0;i<N;i++){int a;cin>>a;++A[a];}
  for(int i=0;i<N;i++){int a;cin>>a;++B[a];}
  for(int i=0;i<N;i++){int a;cin>>a;++C[a];}
  for(int i=0;i<3000;i++){
    A[i+1]+=A[i];
  }
  long long ans=0;
  for(int i=1;i<=3000;i++){
    for(int j=1;j<=3000;j++){
      ans+=B[i]*C[j]*(A[min(i+j-1,3000)]-A[max(i,j)-1]);
    }
  }
  cout<<ans<<'\n';
}
0