結果
問題 |
No.1623 三角形の制作
|
ユーザー |
|
提出日時 | 2022-09-02 07:19:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,173 bytes |
コンパイル時間 | 2,386 ms |
コンパイル使用メモリ | 207,496 KB |
最終ジャッジ日時 | 2025-02-07 00:34:03 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | TLE * 2 |
other | TLE * 19 |
ソースコード
typedef long long ll; typedef long double ld; #include <bits/stdc++.h> using namespace std; #define int long long signed main(){ cin.tie(0); ios::sync_with_stdio(false); ll n; std::cin >> n; map<ll,ll> cnt1,cnt2,cnt3; for (int i = 0; i < n; i++) { ll a; std::cin >> a; cnt1[a]++; } for (int i = 0; i < n; i++) { ll a; std::cin >> a; cnt2[a]++; } for (int i = 0; i < n; i++) { ll a; std::cin >> a; cnt3[a]++; } vector<vector<ll>> dp(6001,vector<ll>(3001)); for (int i = 0; i <= 6000; i++) { for (int j = 0; j <= i; j++) { dp[i][max(j,i-j)] += cnt2[i-j]*cnt3[j]; } } vector<ll> ruic(3001); for (int i = 1; i <= 3000; i++) { ruic[i] = ruic[i-1]+cnt1[i]; } ll ans = 0; for (int i = 0; i <= 6000; i++) { for (int j = 0; j <= i; j++) { ans += max(0ll,(ruic[i-1]-ruic[j-1]))*dp[i][j]; // if((ruic[i-1]-ruic[j-1]>0*dp[i][j]>0){ // std::cout << i<<" "<<j<<" "<<ans << std::endl; // } } } std::cout << ans << std::endl; }