結果
問題 |
No.461 三角形はいくつ?
|
ユーザー |
|
提出日時 | 2016-12-12 01:20:31 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,218 bytes |
コンパイル時間 | 1,643 ms |
コンパイル使用メモリ | 166,520 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-29 05:45:05 |
合計ジャッジ時間 | 10,404 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 WA * 15 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define pi M_PI #define R cin>> #define Z class #define ll long long #define ln cout<<'\n' #define in(a) insert(a) #define pb(a) push_back(a) #define pd(a) printf("%.10f\n",a) #define mem(a) memset(a,0,sizeof(a)) #define all(c) (c).begin(),(c).end() #define iter(c) __typeof((c).begin()) #define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--) #define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++) #define rep(i,n) REP(i,0,n) #define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++) template<Z A>void pr(A a){cout<<a;ln;} template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);} template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);} template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);} template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;} ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;} const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1}; typedef pair<int,int> P; const double EPS = 1e-10; /* typedef complex<double> P; typedef pair<P,P> L; namespace std {bool operator < (const P& a, const P& b) {return real(a)!=real(b)?real(a)<real(b):imag(a)<imag(b);}} double cross(const P& a, const P& b) {return imag(conj(a)*b);} P crosspoint(const L &l, const L &m) { double A=cross(l.S-l.F,m.S-m.F); double B=cross(l.S-l.F,l.S-m.F); if(fabs(A)<EPS&&fabs(B)<EPS) return m.F; return m.F+B/A*(m.S-m.F); } */ void Main() { int n; cin >> n; vector<double> v[3]; rep(i,3) v[i].pb(0); int ans=1; rep(j,n) { int z; double x,y; cin >> z >> x >> y; /* int r=__gcd(x,y); x/=d; y/=d; */ x/=x+y; y=1-x; rep(i,v[(z+1)%3].size()) { if(v[(z+1)%3][i]>x) break; int k=lower_bound(all(v[(z+2)%3]),x-v[(z+1)%3][i])-v[(z+2)%3].begin(); int k2=upper_bound(all(v[(z+2)%3]),x)-v[(z+2)%3].begin(); int k3=upper_bound(all(v[(z+2)%3]),1-v[(z+1)%3][i])-v[(z+2)%3].begin(); int k4=upper_bound(all(v[(z+2)%3]),x-v[(z+1)%3][i])-v[(z+2)%3].begin(); ans+=k+min(k2,k3)-k4; } v[z].pb(y); sort(all(v[z])); } pr(ans); } int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}