結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 149 ms
5,376 KB
testcase_17 AC 147 ms
5,376 KB
testcase_18 AC 157 ms
5,376 KB
testcase_19 AC 153 ms
5,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 6 ms
5,376 KB
testcase_26 AC 6 ms
5,376 KB
testcase_27 AC 67 ms
5,376 KB
testcase_28 AC 6 ms
5,376 KB
testcase_29 AC 37 ms
5,376 KB
testcase_30 AC 20 ms
5,376 KB
testcase_31 AC 66 ms
5,376 KB
testcase_32 AC 85 ms
5,376 KB
testcase_33 AC 6 ms
5,376 KB
testcase_34 AC 6 ms
5,376 KB
testcase_35 AC 6 ms
5,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;
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 = long double;

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

int main(){
	cin >> n;
	rep(i, n){
		int p;
		ld a, b;
		cin >> p >> a >> b;
		ls[p].push_back(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]){
			// 2本 (1,2)
			if(x + y < 1) ++ans;
			// 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