-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathccc17s3_1.cpp
More file actions
40 lines (32 loc) · 754 Bytes
/
ccc17s3_1.cpp
File metadata and controls
40 lines (32 loc) · 754 Bytes
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
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
vector<int> lengths(n);
for (int& i : lengths) cin >> i;
vector<bool> seen;
int ans = 0;
int ansSize = 0;
for (int s = 0; s <= 4000; s++) {
int temp = 0;
for (int i = 0; i < n; i++) {
for (int j = i+1; j < n; j++) {
if (lengths[i] + lengths[j] == s) {
temp++;
}
}
}
if (temp > ans) {
ans = temp;
ansSize = 1;
}
else if (temp == ans) {
ansSize++;
}
}
cout << ans << " " << ansSize;
}