結果

問題 No.2355 Unhappy Back Dance
ユーザー 沙耶花沙耶花
提出日時 2023-06-16 22:07:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,282 ms / 6,000 ms
コード長 1,098 bytes
コンパイル時間 4,877 ms
コンパイル使用メモリ 272,720 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 20:03:42
合計ジャッジ時間 23,522 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 298 ms
4,376 KB
testcase_07 AC 262 ms
4,376 KB
testcase_08 AC 265 ms
4,376 KB
testcase_09 AC 269 ms
4,376 KB
testcase_10 AC 522 ms
4,376 KB
testcase_11 AC 525 ms
4,380 KB
testcase_12 AC 269 ms
4,376 KB
testcase_13 AC 274 ms
4,376 KB
testcase_14 AC 526 ms
4,380 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 1,282 ms
4,380 KB
testcase_17 AC 1,276 ms
4,376 KB
testcase_18 AC 1,274 ms
4,376 KB
testcase_19 AC 1,268 ms
4,380 KB
testcase_20 AC 1,269 ms
4,376 KB
testcase_21 AC 531 ms
4,380 KB
testcase_22 AC 97 ms
4,380 KB
testcase_23 AC 102 ms
4,376 KB
testcase_24 AC 1,152 ms
4,376 KB
testcase_25 AC 621 ms
4,376 KB
testcase_26 AC 612 ms
4,380 KB
testcase_27 AC 530 ms
4,380 KB
testcase_28 AC 12 ms
4,376 KB
testcase_29 AC 29 ms
4,380 KB
testcase_30 AC 1,053 ms
4,376 KB
testcase_31 AC 763 ms
4,380 KB
testcase_32 AC 75 ms
4,376 KB
testcase_33 AC 433 ms
4,380 KB
testcase_34 AC 6 ms
4,376 KB
testcase_35 AC 14 ms
4,376 KB
testcase_36 AC 531 ms
4,380 KB
testcase_37 AC 283 ms
4,376 KB
testcase_38 AC 350 ms
4,376 KB
testcase_39 AC 273 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001

void go(long long &x,long long &y){
	long long g = gcd(abs(x),abs(y));
	x /= g;
	y /= g;
	if(x==0){
		if(y<0)y *= -1;
	}
	else if(x<0){
		x *= -1;
		y *= -1;
	}
}

int main(){
	
	int N;
	cin>>N;
	
	vector<long long> x(N),y(N);
	rep(i,N)cin>>x[i]>>y[i];
	
	vector<bool> f(N,false);
	rep(i,N){
		map<pair<long long,long long>,vector<pair<pair<long long,long long>,int>>> mp;
		rep(j,N){
			if(i==j)continue;
			long long dx = x[j] - x[i],dy = y[j] - y[i];
			go(dx,dy);
			mp[make_pair(dx,dy)].emplace_back(make_pair(x[j],y[j]),j);
		}
		for(auto a:mp){
			auto t = a.second;
			t.emplace_back(make_pair(x[i],y[i]),i);
			sort(t.begin(),t.end());
			if(t.size()>=3){
				rep(j,t.size()){
					if(t.size()==3&&j==1)continue;
					f[t[j].second] = true;
				}
			}
		}
	}
	int ans = 0;
	rep(i,N){
		if(f[i])ans++;
	}
	
	cout<<ans<<endl;
	
	return 0;
}
0