結果

問題 No.461 三角形はいくつ?
ユーザー tubo28tubo28
提出日時 2016-12-12 16:15:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,078 bytes
コンパイル時間 2,065 ms
コンパイル使用メモリ 174,812 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-07 03:47:33
合計ジャッジ時間 13,242 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 3 ms
6,940 KB
testcase_05 AC 438 ms
6,940 KB
testcase_06 AC 244 ms
6,944 KB
testcase_07 AC 291 ms
6,940 KB
testcase_08 AC 195 ms
6,940 KB
testcase_09 AC 3 ms
6,940 KB
testcase_10 AC 58 ms
6,940 KB
testcase_11 AC 344 ms
6,940 KB
testcase_12 AC 150 ms
6,944 KB
testcase_13 AC 519 ms
6,940 KB
testcase_14 AC 519 ms
6,940 KB
testcase_15 AC 520 ms
6,940 KB
testcase_16 AC 64 ms
6,940 KB
testcase_17 AC 64 ms
6,944 KB
testcase_18 AC 745 ms
6,944 KB
testcase_19 AC 709 ms
6,940 KB
testcase_20 AC 485 ms
6,944 KB
testcase_21 AC 515 ms
6,940 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 6 ms
6,944 KB
testcase_26 AC 7 ms
6,944 KB
testcase_27 AC 180 ms
6,944 KB
testcase_28 AC 7 ms
6,940 KB
testcase_29 AC 154 ms
6,944 KB
testcase_30 AC 74 ms
6,940 KB
testcase_31 AC 299 ms
6,940 KB
testcase_32 AC 387 ms
6,940 KB
testcase_33 AC 6 ms
6,940 KB
testcase_34 AC 6 ms
6,944 KB
testcase_35 AC 6 ms
6,944 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;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << x << endl

using ld = __float128;

int n;
vector<ld> ls[3];

int main(){
	while(cin >> n){
		for(int i = 0; i < 3; ++i) ls[i].clear();
		rep(i, n){
			int p;
			int a, b;
			cin >> p >> a >> b;
			ls[p].push_back((ld)a / (a + b));
		}
		for(int i = 0; i < 3; ++i) sort(all(ls[i]));

		// 1本
		ll ans = n + 1;
		
		for(auto &x : ls[1]){
			x = 1 - x;
			ans += ls[0].end() - upper_bound(all(ls[0]), x);
		}
		for(auto &y : ls[2]){
			y = 1 - y;
			ans += ls[0].end() - upper_bound(all(ls[0]), y);
		}

		for(ld x : ls[1]){
			for(ld y : ls[2]){
				if(x + y < 1){
					// 2本 (1,2)
					++ans;
				}
				if(x + y < 1 + 1e-17){
					// 3本 (0,1,2)
					int a = lower_bound(all(ls[0]), x + y) - lower_bound(all(ls[0]), max(x, y));
					int b = upper_bound(all(ls[0]), 10000) - upper_bound(all(ls[0]), x + y);
					ans += a + b;
				}
			}
		}
		cout << ans << endl;
	}
}
0