結果

問題 No.2355 Unhappy Back Dance
ユーザー hiro71687khiro71687k
提出日時 2023-06-16 22:16:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,633 ms / 6,000 ms
コード長 931 bytes
コンパイル時間 2,117 ms
コンパイル使用メモリ 209,052 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 20:22:44
合計ジャッジ時間 21,668 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 132 ms
4,380 KB
testcase_11 AC 129 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 140 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1,623 ms
4,376 KB
testcase_17 AC 1,622 ms
4,380 KB
testcase_18 AC 1,625 ms
4,380 KB
testcase_19 AC 1,633 ms
4,376 KB
testcase_20 AC 1,612 ms
4,380 KB
testcase_21 AC 665 ms
4,380 KB
testcase_22 AC 126 ms
4,380 KB
testcase_23 AC 142 ms
4,380 KB
testcase_24 AC 1,504 ms
4,380 KB
testcase_25 AC 797 ms
4,376 KB
testcase_26 AC 786 ms
4,380 KB
testcase_27 AC 676 ms
4,380 KB
testcase_28 AC 15 ms
4,380 KB
testcase_29 AC 36 ms
4,376 KB
testcase_30 AC 1,388 ms
4,380 KB
testcase_31 AC 968 ms
4,380 KB
testcase_32 AC 93 ms
4,380 KB
testcase_33 AC 560 ms
4,380 KB
testcase_34 AC 7 ms
4,380 KB
testcase_35 AC 16 ms
4,380 KB
testcase_36 AC 676 ms
4,376 KB
testcase_37 AC 355 ms
4,380 KB
testcase_38 AC 440 ms
4,380 KB
testcase_39 AC 346 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll inf=200000000000000;
ll mod=998244353;
ll gcd(ll a, ll b) {
	a = abs(a); b = abs(b);
	if (a < b)swap(a, b);
	while (b) {
	    ll r=a%b;
        a=b;
	    b=r;
	}
	return a;
}
int main(){
    ll n;
    cin >> n;
    vector<ll>x(n),y(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> x[i] >> y[i];
    }
    ll ans=0;
    for (ll i = 0; i < n; i++)
    {
        map<pair<ll,ll>,ll>memo;
        for (ll j = 0; j < n; j++)
        {
            if (i==j)
            {
                continue;
            }
            ll xx=(x[i]-x[j]),yy=y[i]-y[j];
            ll z=gcd(abs(xx),abs(yy));
            xx/=z;
            yy/=z;
            memo[{xx,yy}]+=1;
            if (memo[{xx,yy}]>=2)
            {
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
}
0