結果
| 問題 | No.461 三角形はいくつ? |
| コンテスト | |
| ユーザー |
👑 kmjp
|
| 提出日時 | 2016-12-12 00:20:02 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,437 bytes |
| 記録 | |
| コンパイル時間 | 1,711 ms |
| コンパイル使用メモリ | 171,124 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-29 04:11:00 |
| 合計ジャッジ時間 | 6,690 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 WA * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------
int N;
int P[404040],A[404040],B[404040];
vector<long double> V[3];
ll ret;
set<long double> S[3];
void solve() {
int i,j,k,l,r,x,y; string s;
long double eps=1e-14;
cin>>N;
FOR(i,N) {
cin>>P[i]>>A[i]>>B[i];
V[P[i]].push_back((long double)1.0*A[i]/(A[i]+B[i]));
S[P[i]].insert((long double)1.0*A[i]/(A[i]+B[i]));
}
FOR(i,3) sort(ALL(V[i]));
ll ret=N+1;
FORR(r,V[0]) {
FORR(r2,V[1]) if(r2>1-r+eps) ret++;
FORR(r2,V[2]) if(r2>1-r+eps) ret++;
}
FORR(r,V[1]) {
FORR(r2,V[2]) if(r2>1-r+eps) ret++;
}
FORR(r,V[0]) FORR(r2,V[1]) {
if(r+r2<1-eps) continue;
long double hoge=1-min(r,r2);
ret += V[2].end()-lower_bound(ALL(V[2]),hoge-eps);
hoge=r+r2-1;
ret-=lower_bound(ALL(V[2]),hoge+eps)-lower_bound(ALL(V[2]),hoge-eps);
}
cout<<ret<<endl;
}
int main(int argc,char** argv){
string s;int i;
if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
FOR(i,argc-1) s+=argv[i+1],s+='\n';
FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
solve(); return 0;
}
kmjp