結果

問題 No.461 三角形はいくつ?
ユーザー chocoruskchocorusk
提出日時 2019-12-07 16:31:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,343 bytes
コンパイル時間 979 ms
コンパイル使用メモリ 114,092 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-26 20:44:55
合計ジャッジ時間 4,214 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 73 ms
4,376 KB
testcase_06 AC 43 ms
4,376 KB
testcase_07 AC 51 ms
4,380 KB
testcase_08 AC 34 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 12 ms
4,376 KB
testcase_11 AC 57 ms
4,376 KB
testcase_12 AC 27 ms
4,376 KB
testcase_13 AC 85 ms
4,380 KB
testcase_14 AC 80 ms
4,376 KB
testcase_15 AC 85 ms
4,376 KB
testcase_16 AC 8 ms
4,376 KB
testcase_17 AC 8 ms
4,376 KB
testcase_18 AC 50 ms
4,380 KB
testcase_19 AC 49 ms
4,376 KB
testcase_20 AC 86 ms
4,380 KB
testcase_21 AC 83 ms
4,384 KB
testcase_22 AC 81 ms
4,380 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 43 ms
4,380 KB
testcase_26 AC 42 ms
4,380 KB
testcase_27 AC 5 ms
4,380 KB
testcase_28 AC 6 ms
4,376 KB
testcase_29 AC 77 ms
4,376 KB
testcase_30 AC 77 ms
4,380 KB
testcase_31 AC 76 ms
4,380 KB
testcase_32 AC 75 ms
4,380 KB
testcase_33 AC 5 ms
4,376 KB
testcase_34 AC 5 ms
4,380 KB
testcase_35 AC 5 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 <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;

int main()
{
    int n;
    cin>>n;
    vector<double> v[3];
    for(int i=0; i<n; i++){
        int p; double a, b;
        cin>>p>>a>>b;
        v[p].push_back(a/(a+b));
    }
    for(int i=0; i<3; i++){
        v[i].push_back(1);
        sort(v[i].begin(), v[i].end());
    }
    ll ans=0;
    for(int i=0; i<v[0].size(); i++){
        for(int j=0; j<v[1].size(); j++){
            double x=v[0][i], y=v[1][j];
            if(x+y<1) continue;
            double z=max(1-x, 1-y);
            int k=lower_bound(v[2].begin(), v[2].end(), z)-v[2].begin();
            ans+=(int)v[2].size()-k;
            k=lower_bound(v[2].begin(), v[2].end(), 2-x-y)-v[2].begin();
            if(k<v[2].size() && x+y+v[2][k]==2 && x+v[2][k]>=1 && y+v[2][k]>=1) ans--;
        }
    }
    cout<<ans<<endl;
    return 0;
}
0