結果
問題 | No.2355 Unhappy Back Dance |
ユーザー |
|
提出日時 | 2023-06-16 23:14:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,526 ms / 6,000 ms |
コード長 | 1,438 bytes |
コンパイル時間 | 1,711 ms |
コンパイル使用メモリ | 178,680 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-24 16:21:41 |
合計ジャッジ時間 | 21,055 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;template<class T> istream& operator >> (istream& is, vector<T>& vec) {for(T& x : vec) is >> x;return is;}template<class T> ostream& operator << (ostream& os, const vector<T>& vec) {if(vec.empty()) return os;os << vec[0];for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it;return os;}int main(){ios::sync_with_stdio(false);cin.tie(0);int n;cin >> n;vector<pair<ll,ll>> a(n);ll x, y, x2, y2;for(int i = 0; i < n; i++){cin >> x >> y;a[i] = {x, y};}vector<bool> used(n);for(int i = 0; i < n; i++){vector<pair<ll,ll>> b(n);for(int j = 0; j < n; j++){b[j].first = a[j].first - a[i].first;b[j].second = a[j].second - a[i].second;ll g = __gcd(b[j].first, b[j].second);g = abs(g);if(g >= 1){b[j].first /= g;b[j].second /= g;}}auto c = b;sort(c.begin(), c.end());for(int j = 0; j < n; j++){ll x, y;tie(x, y) = b[j];if(j == i) continue;x *= -1, y *= -1;if(binary_search(c.begin(), c.end(), make_pair(x, y))){used[j] = true;}}}cout << count(used.begin(), used.end(), true) << '\n';}