結果
| 問題 | No.461 三角形はいくつ? |
| コンテスト | |
| ユーザー |
tubo28
|
| 提出日時 | 2016-12-12 15:33:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 941 bytes |
| 記録 | |
| コンパイル時間 | 1,785 ms |
| コンパイル使用メモリ | 173,964 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-29 16:00:17 |
| 合計ジャッジ時間 | 7,710 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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 = 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;
}
tubo28