-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabc248_e.cpp
More file actions
59 lines (48 loc) · 1.25 KB
/
abc248_e.cpp
File metadata and controls
59 lines (48 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
pair<ll,ll> points[300];
bool used[300][300];
bool check(int a, int b, int c) {
auto [x1, y1] = points[a];
auto [x2, y2] = points[b];
auto [x3, y3] = points[c];
return (x2-x1)*(y3-y1) == (x3-x1)*(y2-y1);
}
void solve(){
int N, K; cin >> N >> K;
if (K == 1) {
cout << "Infinity";
return;
}
for (int i = 0; i < N; i++) {
cin >> points[i].first >> points[i].second;
}
int result = 0;
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
if (used[i][j]) continue;
vector<int> p;
p.push_back(i);
p.push_back(j);
for (int k = j + 1; k < N; k++) {
if (check(i,j,k)) {
p.push_back(k);
}
}
for (int pi = 0; pi < p.size(); pi++) {
for (int pj = pi + 1; pj < p.size(); pj++) {
used[p[pi]][p[pj]]=true;
}
}
if (p.size() >= K) result++;
}
}
cout << result;
}
int main()
{
cin.tie(0)->sync_with_stdio(false);
solve();
return 0;
}