結果

問題 No.1623 三角形の制作
ユーザー saksak
提出日時 2021-06-20 02:07:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 162 ms / 2,000 ms
コード長 1,189 bytes
コンパイル時間 1,907 ms
コンパイル使用メモリ 201,072 KB
実行使用メモリ 8,108 KB
最終ジャッジ日時 2023-09-25 20:50:55
合計ジャッジ時間 5,316 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
4,380 KB
testcase_01 AC 22 ms
4,376 KB
testcase_02 AC 97 ms
6,104 KB
testcase_03 AC 94 ms
5,984 KB
testcase_04 AC 93 ms
5,920 KB
testcase_05 AC 152 ms
8,072 KB
testcase_06 AC 41 ms
4,376 KB
testcase_07 AC 93 ms
5,976 KB
testcase_08 AC 43 ms
4,380 KB
testcase_09 AC 88 ms
5,848 KB
testcase_10 AC 129 ms
7,256 KB
testcase_11 AC 106 ms
6,424 KB
testcase_12 AC 60 ms
5,024 KB
testcase_13 AC 70 ms
5,348 KB
testcase_14 AC 68 ms
5,232 KB
testcase_15 AC 139 ms
8,080 KB
testcase_16 AC 138 ms
8,096 KB
testcase_17 AC 140 ms
8,048 KB
testcase_18 AC 162 ms
8,108 KB
testcase_19 AC 72 ms
6,236 KB
testcase_20 AC 22 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (ll i=(ll)N-1; i>=0; i--)
#define popcount __builtin_popcount

const ll LLINF = pow(2,61)-1;
const ll INF = pow(2,30)-1;

ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

int main() {
  ll n; cin >> n;
  ll r[n]; rep(i,n) cin >> r[i];
  ll g[n]; rep(i,n) cin >> g[i];
  ll b[n]; rep(i,n) cin >> b[i];

  ll MA = 3 * pow(10,3) + 10;
  vector<ll> cr(MA), cg(MA), cb(MA);
  rep(i,n) { cr[r[i]]++; cb[b[i]]++; cg[g[i]]++; }
  vector<ll> rui_cr(MA); rep(i,MA) rui_cr[i] = i==0 ? 0 : rui_cr[i-1] + cr[i];
  // debug(all(rui_cr));

  ll result = 0;
  rep(ig,MA) rep(ib,MA) {
    ll from = max(max(ig, ib), abs(ig-ib)+1), to = min(MA-1, ig+ib-1);
    result += (rui_cr[to] - rui_cr[from-1]) * cg[ig] * cb[ib];
  }
  cout << result << endl;
  return 0;
}
0