結果
| 問題 |
No.1623 三角形の制作
|
| コンテスト | |
| ユーザー |
Manuel1024
|
| 提出日時 | 2022-05-16 03:01:54 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 154 ms / 2,000 ms |
| コード長 | 821 bytes |
| コンパイル時間 | 877 ms |
| コンパイル使用メモリ | 77,188 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-13 15:49:01 |
| 合計ジャッジ時間 | 4,544 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
using ll = long long;
int main(){
int n; cin >> n;
vector<int> r(n), g(n), b(n);
for(auto &it: r) cin >> it;
for(auto &it: g) cin >> it;
for(auto &it: b) cin >> it;
vector<int> rcnt(3010, 0), gcnt(3010, 0), bcnt(3010, 0);
for(auto &it: r) rcnt[it]++;
for(auto &it: g) gcnt[it]++;
for(auto &it: b) bcnt[it]++;
vector<int> btot(3020, 0);
for(int i = 0; i < 3010; i++) btot[i+1] = btot[i]+bcnt[i];
ll ans = 0;
for(int i = 1; i < 3010; i++){
if(rcnt[i] == 0) continue;
for(int j = 1; j <= i; j++){
if(gcnt[j] == 0) continue;
ans += 1LL*rcnt[i]*gcnt[j]*(btot[i+1]-btot[i-j+1]);
}
}
cout << ans << endl;
return 0;
}
Manuel1024