結果

問題 No.461 三角形はいくつ?
ユーザー kzyKTkzyKT
提出日時 2016-12-12 01:20:31
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,218 bytes
コンパイル時間 1,748 ms
コンパイル使用メモリ 166,024 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-06 19:51:02
合計ジャッジ時間 11,208 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 282 ms
5,376 KB
testcase_06 AC 158 ms
5,376 KB
testcase_07 AC 187 ms
5,376 KB
testcase_08 AC 123 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 37 ms
5,376 KB
testcase_11 AC 216 ms
5,376 KB
testcase_12 AC 93 ms
5,376 KB
testcase_13 AC 319 ms
5,376 KB
testcase_14 AC 314 ms
5,376 KB
testcase_15 AC 322 ms
5,376 KB
testcase_16 AC 90 ms
5,376 KB
testcase_17 AC 90 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 323 ms
5,376 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 178 ms
5,376 KB
testcase_26 AC 171 ms
5,376 KB
testcase_27 AC 180 ms
5,376 KB
testcase_28 AC 177 ms
5,376 KB
testcase_29 AC 235 ms
5,376 KB
testcase_30 AC 213 ms
5,376 KB
testcase_31 AC 238 ms
5,376 KB
testcase_32 AC 242 ms
5,376 KB
testcase_33 AC 323 ms
5,376 KB
testcase_34 AC 325 ms
5,376 KB
testcase_35 AC 323 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;
#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;}
0