結果

問題 No.1623 三角形の制作
ユーザー nuxxppnuxxpp
提出日時 2021-07-31 11:10:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 354 ms / 2,000 ms
コード長 1,575 bytes
コンパイル時間 3,597 ms
コンパイル使用メモリ 159,264 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-14 14:41:49
合計ジャッジ時間 8,739 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,372 KB
testcase_01 AC 1 ms
4,372 KB
testcase_02 AC 229 ms
4,368 KB
testcase_03 AC 219 ms
4,372 KB
testcase_04 AC 219 ms
4,368 KB
testcase_05 AC 354 ms
4,372 KB
testcase_06 AC 100 ms
4,368 KB
testcase_07 AC 223 ms
4,372 KB
testcase_08 AC 106 ms
4,372 KB
testcase_09 AC 212 ms
4,368 KB
testcase_10 AC 300 ms
4,372 KB
testcase_11 AC 250 ms
4,372 KB
testcase_12 AC 13 ms
4,368 KB
testcase_13 AC 17 ms
4,372 KB
testcase_14 AC 16 ms
4,368 KB
testcase_15 AC 39 ms
4,372 KB
testcase_16 AC 39 ms
4,368 KB
testcase_17 AC 40 ms
4,372 KB
testcase_18 AC 45 ms
4,372 KB
testcase_19 AC 20 ms
4,368 KB
testcase_20 AC 1 ms
4,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <deque>
#include <stack>
#include <atcoder/all>
#include <array>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < (t); ++i)
#define dsrep(i,t,s) for(int i = (t)-1; i >= (s); --i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
using ll = long long;
using uint = unsigned;
using ull = unsigned long long;
using P = pair<int,int>;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
// const ll mod = 998244353;
const ll mod = 1e9 + 7;

///////////////////////////////////////////
int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  vector<int> r(3001, 0);
  vector<int> g(3001, 0);
  vector<int> b(n);

  rep(i, n) {
    int tr; cin >> tr;
    r[tr]++;
  }

  rep(i, n) {
    int tg; cin >> tg;
    g[tg]++;
  }

  rep(i, n) cin >> b[i];
  sort(b.begin(), b.end());

  ll ans = 0;
  rrep(i, 3000) {
    if(r[i] == 0) continue;

    ll t = 0;
    int now = i;
    for(int j=0; j<n && b[j]<=i; j++) {
      while(i - b[j] < now) {
        t += g[now];
        now--;
      }
      ans += t * (ll)r[i];
    }
  }

  cout << ans << endl;
}
0