結果

問題 No.461 三角形はいくつ?
ユーザー ytftytft
提出日時 2021-04-04 14:21:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,351 bytes
コンパイル時間 3,098 ms
コンパイル使用メモリ 178,168 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-27 15:19:24
合計ジャッジ時間 6,769 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 117 ms
4,376 KB
testcase_06 AC 61 ms
4,380 KB
testcase_07 AC 67 ms
4,376 KB
testcase_08 AC 48 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 14 ms
4,376 KB
testcase_11 AC 80 ms
4,380 KB
testcase_12 AC 37 ms
4,380 KB
testcase_13 AC 127 ms
4,376 KB
testcase_14 AC 123 ms
4,376 KB
testcase_15 AC 132 ms
4,376 KB
testcase_16 AC 7 ms
4,380 KB
testcase_17 AC 6 ms
4,380 KB
testcase_18 AC 231 ms
4,376 KB
testcase_19 AC 240 ms
4,380 KB
testcase_20 AC 123 ms
4,380 KB
testcase_21 AC 132 ms
4,380 KB
testcase_22 AC 137 ms
4,380 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 5 ms
4,380 KB
testcase_26 AC 6 ms
4,376 KB
testcase_27 AC 6 ms
4,376 KB
testcase_28 AC 6 ms
4,380 KB
testcase_29 AC 56 ms
4,380 KB
testcase_30 AC 29 ms
4,380 KB
testcase_31 AC 104 ms
4,380 KB
testcase_32 AC 135 ms
4,376 KB
testcase_33 AC 5 ms
4,380 KB
testcase_34 AC 6 ms
4,376 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 <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<vector<double>> lines(3,vector<double>(1,0));
    int p;
    long long ans=0;
    double a,b;
    for(int i=0;i<N;i++){
        cin>>p>>a>>b;
        lines[p].push_back(b/(b+a));
    }
    for(int i=0;i<3;i++){
        sort(lines[i].begin(),lines[i].end());
    }
    int m,M,mid;
    sort(lines.begin(),lines.end(),[](vector<double>& a,vector<double>& b){return a.size()<b.size();});
    for(int i=0;i<lines[0].size();i++){
        for(int j=0;j<lines[1].size();j++){
            if(lines[0][i]+lines[1][j]>1){
                continue;
            }
            m=0;
            M=lines[2].size();

            while(M-m>1){
                mid=(m+M)/2;
                if(lines[2][mid]+lines[0][i]+lines[1][j]>1){
                    M=mid;
                }else{
                    m=mid;
                }
            }
            if(lines[2][m]+lines[0][i]+lines[1][j]==1){
                ans-=1;
            }
            m=-1;
            M=lines[2].size();
            while(M-m>1){
                mid=(m+M)/2;
                if(lines[2][mid]+max(lines[0][i],lines[1][j])>1){
                    M=mid;
                }else{
                    m=mid;
                }
            }
            ans+=m+1;
        }
    }
    cout<<ans<<endl;
}
0