結果
| 問題 | No.461 三角形はいくつ? |
| コンテスト | |
| ユーザー |
tubo28
|
| 提出日時 | 2016-12-12 15:35:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 945 bytes |
| 記録 | |
| コンパイル時間 | 1,688 ms |
| コンパイル使用メモリ | 173,388 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-29 16:01:01 |
| 合計ジャッジ時間 | 22,285 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 WA * 26 |
ソースコード
#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(){
cin >> n;
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]){
// 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;
}
tubo28