結果

問題 No.1144 Triangles
ユーザー leaf_1415leaf_1415
提出日時 2020-07-31 22:55:44
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,601 bytes
コンパイル時間 1,750 ms
コンパイル使用メモリ 83,196 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-21 01:43:33
合計ジャッジ時間 9,013 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 40 ms
4,380 KB
testcase_20 AC 4 ms
4,376 KB
testcase_21 AC 4 ms
4,376 KB
testcase_22 WA -
testcase_23 AC 29 ms
4,376 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 17 ms
4,376 KB
testcase_27 AC 196 ms
4,376 KB
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define PI 3.141592653589793238462643383279502884197169393
#define eps 1e-12
#define mod 1000000007

using namespace std;
typedef pair<double, llint> P;

llint n;
llint x[2005], y[2005];
vector<P> vec;

llint get(llint x)
{
	return (x%mod+mod)%mod;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> x[i] >> y[i];
	
	llint ans = 0;
	for(int i = 1; i <= n; i++){
		vec.clear();
		for(int j = 1; j <= n; j++){
			if(i == j) continue;
			vec.push_back(P(atan2((double)y[j]-y[i], (double)x[j]-x[i]), j));
		}
		sort(vec.begin(), vec.end());
		
		for(int j = 0; j < n-1; j++){
			vec.push_back(vec[j]);
			vec.back().first += 2 * PI;
		}
		llint l = 0, r = 0;
		for(int j = 0; j < n-1; j++){
			double ang = vec[j].first;
			llint id = vec[j].second;
			while(vec[l+1].first <= ang) l++;
			while(vec[r+1].first < ang+PI) r++;
			llint tmp = (get(x[i])*get(y[id])%mod + mod - get(x[id])*get(y[i])%mod) % mod;
			tmp *= r-l, tmp %= mod;
			ans += tmp, ans %= mod;
		}
	}
	cout << ans << endl;
	
	return 0;
}
0