結果

問題 No.461 三角形はいくつ?
ユーザー titiatitia
提出日時 2023-09-19 03:28:25
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,052 bytes
コンパイル時間 1,965 ms
コンパイル使用メモリ 115,036 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-19 03:28:30
合計ジャッジ時間 5,280 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 59 ms
4,376 KB
testcase_06 AC 31 ms
4,376 KB
testcase_07 AC 39 ms
4,380 KB
testcase_08 AC 26 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 9 ms
4,380 KB
testcase_11 AC 43 ms
4,376 KB
testcase_12 AC 20 ms
4,380 KB
testcase_13 AC 65 ms
4,376 KB
testcase_14 AC 60 ms
4,380 KB
testcase_15 AC 63 ms
4,380 KB
testcase_16 AC 6 ms
4,380 KB
testcase_17 AC 6 ms
4,380 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 63 ms
4,380 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 41 ms
4,380 KB
testcase_26 AC 41 ms
4,380 KB
testcase_27 AC 7 ms
4,380 KB
testcase_28 AC 6 ms
4,384 KB
testcase_29 AC 153 ms
4,384 KB
testcase_30 AC 134 ms
4,376 KB
testcase_31 AC 154 ms
4,376 KB
testcase_32 AC 154 ms
4,380 KB
testcase_33 AC 6 ms
4,384 KB
testcase_34 AC 6 ms
4,380 KB
testcase_35 AC 6 ms
4,376 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

int main() {
    vector<vector<long double>> L(3, vector<long double>(1, 0.0));

    int N;
    cin >> N;

    for (int i = 0; i < N; ++i) {
        int p;
        long double a, b;
        cin >> p >> a >> b;
        L[p].push_back(b / (a + b));
    }

    sort(L[0].begin(), L[0].end());
    sort(L[1].begin(), L[1].end());
    sort(L[2].begin(), L[2].end());

    int ANS = 0;
    set<long double> SET(L[2].begin(), L[2].end());

    for (long double x : L[0]) {
        for (long double y : L[1]) {
            if (x + y > 1.0) {
                break;
            }
            long double MAX = max(x, y);
            auto it = lower_bound(L[2].begin(), L[2].end(), 1.0 - MAX);
            int k = distance(L[2].begin(), it);
            ANS += k;
            long double z = x + y;
            if (z < 1.0 - MAX && SET.find(1.0 - z) != SET.end()) {
                ANS -= 1;
            }
        }
    }

    cout << ANS << endl;

    return 0;
}
0