2746 | 2023-01-20 18:51:48 | Catt | Varázserdő | cpp17 | Wrong answer 0/100 | 1.916s | 291944 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int n,m;
cin >> n >> m;
vector<pair<int, pair<int, int>> > g(m);
for(int i = 0; i < m; i++) {
int x,y,z;
cin >> x >> y >> z;
g[i] = {z, {x, y}};
}
vector<map<int, int> > v(n+1);
int mo = 0;
sort(g.begin(), g.end());
for(int i = 0; i < m; i++) {
int x,y,z;
z = g[i].first, x = g[i].second.first, y = g[i].second.second;
mo += v[x][z-1] + v[y][z-1] + 2;
v[x][z] += v[y][z-1] + 1;
v[y][z] += v[x][z-1] + 1;
}
cout << mo - n;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1816 KiB | ||||
2 | Wrong answer | 2ms | 2048 KiB | ||||
3 | Accepted | 2ms | 2296 KiB | ||||
subtask2 | 0/7 | ||||||
4 | Wrong answer | 2ms | 2520 KiB | ||||
5 | Wrong answer | 3ms | 2876 KiB | ||||
6 | Wrong answer | 16ms | 6488 KiB | ||||
7 | Wrong answer | 17ms | 7240 KiB | ||||
8 | Wrong answer | 1.162s | 244112 KiB | ||||
9 | Wrong answer | 1.062s | 230772 KiB | ||||
10 | Wrong answer | 859ms | 217072 KiB | ||||
11 | Wrong answer | 893ms | 207072 KiB | ||||
12 | Wrong answer | 783ms | 203020 KiB | ||||
13 | Wrong answer | 777ms | 202564 KiB | ||||
subtask3 | 0/9 | ||||||
14 | Accepted | 3ms | 3700 KiB | ||||
15 | Accepted | 3ms | 4060 KiB | ||||
16 | Accepted | 146ms | 38312 KiB | ||||
17 | Wrong answer | 669ms | 61620 KiB | ||||
18 | Wrong answer | 1.889s | 230544 KiB | ||||
19 | Wrong answer | 1.284s | 175908 KiB | ||||
20 | Wrong answer | 1.294s | 181216 KiB | ||||
subtask4 | 0/14 | ||||||
21 | Wrong answer | 2ms | 4240 KiB | ||||
22 | Wrong answer | 2ms | 4252 KiB | ||||
23 | Wrong answer | 2ms | 4380 KiB | ||||
24 | Wrong answer | 2ms | 4452 KiB | ||||
subtask5 | 0/20 | ||||||
25 | Accepted | 3ms | 4812 KiB | ||||
26 | Wrong answer | 8ms | 6148 KiB | ||||
27 | Wrong answer | 8ms | 5604 KiB | ||||
28 | Wrong answer | 8ms | 6460 KiB | ||||
29 | Wrong answer | 8ms | 6372 KiB | ||||
30 | Wrong answer | 8ms | 6192 KiB | ||||
31 | Wrong answer | 8ms | 5964 KiB | ||||
32 | Wrong answer | 7ms | 6036 KiB | ||||
subtask6 | 0/50 | ||||||
33 | Accepted | 17ms | 9328 KiB | ||||
34 | Accepted | 193ms | 51820 KiB | ||||
35 | Wrong answer | 1.049s | 39556 KiB | ||||
36 | Wrong answer | 1.093s | 42804 KiB | ||||
37 | Wrong answer | 1.677s | 237292 KiB | ||||
38 | Wrong answer | 1.916s | 262704 KiB | ||||
39 | Wrong answer | 1.807s | 291944 KiB | ||||
40 | Wrong answer | 1.623s | 268552 KiB | ||||
41 | Wrong answer | 1.455s | 109340 KiB |