Skip to content

Commit a1759e1

Browse files
committed
add icpc folder
1 parent 9822042 commit a1759e1

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <iostream>
2+
#include <map>
3+
4+
using namespace std;
5+
using ll = long long;
6+
7+
void solve() {
8+
int n;
9+
cin >> n;
10+
map<ll, ll> mp;
11+
ll x;
12+
for(int i = 0; i < n; i++) {
13+
cin >> x;
14+
mp[x]++;
15+
}
16+
17+
ll ans = 0;
18+
ll sum = 0;
19+
for(auto [k,v]: mp) {
20+
if (v >= 3) ans += v*(v-1)*(v-2)/6;
21+
if (v >= 2) ans += v*(v-1)*sum/2;
22+
sum += v;
23+
}
24+
cout << ans << endl;
25+
}
26+
27+
int main(int argc, char *argv[]) {
28+
int T;
29+
std::cin >> T;
30+
while(T--) {
31+
solve();
32+
}
33+
return 0;
34+
}

icpc/2024/national/04_Dune.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <iostream>
2+
3+
using namespace std;
4+
5+
void solve() {
6+
int g, w, r, t;
7+
cin >> g >> w >> r >> t;
8+
int cycle = g + w + r;
9+
if (t >= cycle) t = t%cycle;
10+
if (t < g) {
11+
cout << "Guiding Beat\n";
12+
} else if (t < g+w) {
13+
cout << "Warning Beat\n";
14+
} else if (t < g+w+r) {
15+
cout << "Resting Phase\n";
16+
}
17+
}
18+
19+
int main(int argc, char *argv[]) {
20+
int T;
21+
std::cin >> T;
22+
while(T--) {
23+
solve();
24+
}
25+
return 0;
26+
}

0 commit comments

Comments
 (0)