結果

問題 No.461 三角形はいくつ?
ユーザー koba-e964koba-e964
提出日時 2016-12-12 10:48:40
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,377 bytes
コンパイル時間 1,161 ms
コンパイル使用メモリ 97,464 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-07 03:01:38
合計ジャッジ時間 16,875 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 WA -
testcase_03 AC 1 ms
6,940 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 400 ms
6,940 KB
testcase_19 AC 410 ms
6,940 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 872 ms
6,940 KB
testcase_26 AC 874 ms
6,940 KB
testcase_27 AC 5 ms
6,940 KB
testcase_28 AC 5 ms
6,944 KB
testcase_29 AC 804 ms
6,944 KB
testcase_30 AC 849 ms
6,944 KB
testcase_31 AC 730 ms
6,944 KB
testcase_32 AC 669 ms
6,944 KB
testcase_33 AC 5 ms
6,944 KB
testcase_34 AC 6 ms
6,940 KB
testcase_35 AC 6 ms
6,944 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 <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void){
  int n;
  cin >> n;
  vector<PI> pool[3];
  REP(i, 0, 3) {
    pool[i].push_back(PI(0, 1));
  }
  REP(i, 0, n) {
    int p, a, b;
    cin >> p >> a >> b;
    int g = __gcd(a, b);
    a /= g;
    b /= g;
    pool[p].push_back(PI(b, a + b));
  }
  ll tot = (ll)(pool[0].size() * pool[1].size())
    * pool[2].size();
  set<PI> pool2(pool[2].begin(), pool[2].end());
  REP(i, 0, pool[0].size()) {
    REP(j, 0, pool[1].size()) {
      PI u = pool[0][i];
      PI v = pool[1][j];
      PI w = PI(u.second * v.second - u.first * v.second - u.second * v.first,
		u.second * v.second);
      int g = __gcd(w.first, w.second);
      w.first /= g;
      w.second /= g;
      if (pool2.count(w)) {
	tot--;
      }
    }
  }
  cout << tot << endl;
}
0