結果
| 問題 | No.461 三角形はいくつ? |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-12 03:54:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 956 bytes |
| 記録 | |
| コンパイル時間 | 1,501 ms |
| コンパイル使用メモリ | 176,612 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-29 14:00:27 |
| 合計ジャッジ時間 | 3,505 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 3 WA * 38 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
typedef pair<int,int> pi;
struct line{ int p,a,b; };
inline int intersect_inside(line m, line n)
{
if(m.a*(n.a+n.b) > n.b*(m.a+m.b)) return 1;
return 0;
}
int main()
{
int n;
scanf(" %d", &n);
vector<line> l(n);
rep(i,n)
{
scanf(" %d %d %d", &l[i].p, &l[i].a, &l[i].b);
int G=__gcd(l[i].a,l[i].b);
l[i].a/=G;
l[i].b/=G;
}
int two=0,three=0;
rep(i,n)rep(j,i)if(l[i].p!=l[j].p) two+=intersect_inside(l[i],l[j]);
map<pi,int> ct;
rep(i,n)if(l[i].a >= l[i].b) ++ct[pi(l[i].a,l[i].b)];
for(const auto &x:ct) three+=(x.se==3);
printf("%d\n", 1+n+two+three);
return 0;
}