結果

問題 No.655 E869120 and Good Triangles
ユーザー vjudge1
提出日時 2025-07-27 15:26:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,270 bytes
コンパイル時間 1,442 ms
コンパイル使用メモリ 169,320 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-07-27 15:26:38
合計ジャッジ時間 4,930 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 1 WA * 10 RE * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define fi first
#define endl '\n'
#define il inline
#define se second
#define pb push_back
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#ifdef ONLINE_JUDGE
#define debug(...) 0
#else
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#endif
const int N = 4e3 + 10;
const long double eps = 1e-17;
int n;
vector<long double> t[3];
ll ans;
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    cin >> n;
    t[0].pb(1), t[1].pb(1), t[2].pb(1);
    for(int i = 1, p, a, b; i <= n; i++)
        cin >> p >> a >> b, t[p].pb(a / (long double)(a + b));
    sort(t[0].begin(), t[0].end());
    sort(t[1].begin(), t[1].end());
    sort(t[2].begin(), t[2].end());
    for(auto l0 : t[0])
        for(auto l1 : t[1])
        {
            long double ma = max(1 - l0, 1 - l1);
            long double jd = 2 - l0 - l1;
            if (jd > 1 + eps) continue;
            int it1 = lower_bound(t[2].begin(), t[2].end(), ma - eps) - t[2].begin();
            int it2 = lower_bound(t[2].begin(), t[2].end(), jd - eps) - t[2].begin();
            ans += t[2].size() - it1;
            if (fabs(t[2][it2] - jd) < eps) ans--;
        }
    cout << ans << endl;
    return 0;
}
0