結果

問題 No.2355 Unhappy Back Dance
ユーザー kotatsugamekotatsugame
提出日時 2023-06-16 21:47:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,376 ms / 6,000 ms
コード長 665 bytes
コンパイル時間 713 ms
コンパイル使用メモリ 78,060 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 19:15:43
合計ジャッジ時間 18,228 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 100 ms
4,376 KB
testcase_07 AC 82 ms
4,380 KB
testcase_08 AC 103 ms
4,380 KB
testcase_09 AC 104 ms
4,380 KB
testcase_10 AC 222 ms
4,380 KB
testcase_11 AC 219 ms
4,380 KB
testcase_12 AC 116 ms
4,380 KB
testcase_13 AC 116 ms
4,376 KB
testcase_14 AC 243 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1,361 ms
4,376 KB
testcase_17 AC 1,376 ms
4,384 KB
testcase_18 AC 1,369 ms
4,380 KB
testcase_19 AC 1,351 ms
4,384 KB
testcase_20 AC 1,357 ms
4,376 KB
testcase_21 AC 559 ms
4,380 KB
testcase_22 AC 103 ms
4,376 KB
testcase_23 AC 112 ms
4,376 KB
testcase_24 AC 1,219 ms
4,376 KB
testcase_25 AC 654 ms
4,380 KB
testcase_26 AC 662 ms
4,376 KB
testcase_27 AC 561 ms
4,380 KB
testcase_28 AC 13 ms
4,380 KB
testcase_29 AC 31 ms
4,376 KB
testcase_30 AC 1,129 ms
4,380 KB
testcase_31 AC 824 ms
4,380 KB
testcase_32 AC 80 ms
4,376 KB
testcase_33 AC 457 ms
4,376 KB
testcase_34 AC 6 ms
4,380 KB
testcase_35 AC 15 ms
4,384 KB
testcase_36 AC 565 ms
4,376 KB
testcase_37 AC 291 ms
4,380 KB
testcase_38 AC 368 ms
4,380 KB
testcase_39 AC 285 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
long gcd(long a,long b)
{
	while(b)
	{
		long t=a%b;
		a=b;
		b=t;
	}
	return a;
}
int N;
long X[1500],Y[1500];
int main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>X[i]>>Y[i];
	int cnt=0;
	vector<pair<long,long> >T;
	T.reserve(N);
	for(int i=0;i<N;i++)
	{
		T.clear();
		for(int j=0;j<N;j++)if(i!=j)
		{
			long x=X[i]-X[j],y=Y[i]-Y[j];
			long g=abs(gcd(x,y));
			x/=g;
			y/=g;
			T.push_back(make_pair(x,y));
		}
		sort(T.begin(),T.end());
		bool fn=false;
		for(int j=0;j+1<T.size();j++)
		{
			if(T[j]==T[j+1])
			{
				fn=true;
				break;
			}
		}
		if(fn)cnt++;
	}
	cout<<cnt<<endl;
}
0