結果

問題 No.2355 Unhappy Back Dance
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2023-06-16 22:28:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,308 ms / 6,000 ms
コード長 629 bytes
コンパイル時間 2,044 ms
コンパイル使用メモリ 204,248 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 20:43:38
合計ジャッジ時間 18,676 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 95 ms
4,380 KB
testcase_07 AC 114 ms
4,380 KB
testcase_08 AC 112 ms
4,376 KB
testcase_09 AC 109 ms
4,376 KB
testcase_10 AC 223 ms
4,376 KB
testcase_11 AC 236 ms
4,380 KB
testcase_12 AC 126 ms
4,376 KB
testcase_13 AC 121 ms
4,376 KB
testcase_14 AC 234 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1,304 ms
4,380 KB
testcase_17 AC 1,288 ms
4,376 KB
testcase_18 AC 1,308 ms
4,376 KB
testcase_19 AC 1,273 ms
4,380 KB
testcase_20 AC 1,289 ms
4,380 KB
testcase_21 AC 531 ms
4,376 KB
testcase_22 AC 101 ms
4,376 KB
testcase_23 AC 110 ms
4,376 KB
testcase_24 AC 1,176 ms
4,380 KB
testcase_25 AC 611 ms
4,376 KB
testcase_26 AC 630 ms
4,380 KB
testcase_27 AC 551 ms
4,380 KB
testcase_28 AC 12 ms
4,376 KB
testcase_29 AC 29 ms
4,380 KB
testcase_30 AC 1,046 ms
4,376 KB
testcase_31 AC 779 ms
4,380 KB
testcase_32 AC 74 ms
4,376 KB
testcase_33 AC 433 ms
4,376 KB
testcase_34 AC 6 ms
4,376 KB
testcase_35 AC 14 ms
4,380 KB
testcase_36 AC 565 ms
4,380 KB
testcase_37 AC 294 ms
4,376 KB
testcase_38 AC 349 ms
4,380 KB
testcase_39 AC 277 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll gcd(ll a, ll b) {
	return (a ? gcd(b % a, a) : b);
}
int main () {
	int N;
	cin >> N;
	ll X[2020], Y[2020];
	for (int i = 0; i < N; i ++) cin >> X[i] >> Y[i];
	int ans = 0;
	using P = pair<ll, ll>;
	P A[2020];
	for (int i = 0; i < N; i ++) {
		for (int j = 1; j < N; j ++) {
			int k = (i + j) % N;
			ll dx = X[k] - X[i], dy = Y[k] - Y[i];
			ll g = gcd(abs(dx), abs(dy));
			A[j - 1] = P{dx / g, dy / g};
		}
		sort(A, A + (N - 1));
		for (int j = 0; j < N - 2; j ++) {
			if (A[j] == A[j + 1]) {
				ans ++;
				break;
			}
		}
	}
	cout << ans << endl;
}
0