2747 | 2023-01-20 18:54:38 | Catt | Varázserdő | cpp17 | Wrong answer 21/100 | 1.858s | 291500 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 - m;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1804 KiB | ||||
2 | Accepted | 2ms | 2060 KiB | ||||
3 | Accepted | 2ms | 2264 KiB | ||||
subtask2 | 7/7 | ||||||
4 | Accepted | 2ms | 2352 KiB | ||||
5 | Accepted | 3ms | 2744 KiB | ||||
6 | Accepted | 16ms | 6328 KiB | ||||
7 | Accepted | 17ms | 6852 KiB | ||||
8 | Accepted | 990ms | 243776 KiB | ||||
9 | Accepted | 1.07s | 230428 KiB | ||||
10 | Accepted | 971ms | 216780 KiB | ||||
11 | Accepted | 830ms | 206752 KiB | ||||
12 | Accepted | 785ms | 202420 KiB | ||||
13 | Accepted | 783ms | 202160 KiB | ||||
subtask3 | 0/9 | ||||||
14 | Accepted | 2ms | 3156 KiB | ||||
15 | Accepted | 3ms | 3700 KiB | ||||
16 | Accepted | 162ms | 37836 KiB | ||||
17 | Accepted | 703ms | 61168 KiB | ||||
18 | Accepted | 1.858s | 230132 KiB | ||||
19 | Wrong answer | 1.217s | 175764 KiB | ||||
20 | Wrong answer | 1.294s | 181032 KiB | ||||
subtask4 | 14/14 | ||||||
21 | Accepted | 2ms | 3836 KiB | ||||
22 | Accepted | 2ms | 3968 KiB | ||||
23 | Accepted | 2ms | 4040 KiB | ||||
24 | Accepted | 2ms | 4152 KiB | ||||
subtask5 | 0/20 | ||||||
25 | Accepted | 3ms | 4396 KiB | ||||
26 | Accepted | 8ms | 5732 KiB | ||||
27 | Accepted | 8ms | 5288 KiB | ||||
28 | Accepted | 8ms | 5888 KiB | ||||
29 | Accepted | 8ms | 5864 KiB | ||||
30 | Accepted | 8ms | 5756 KiB | ||||
31 | Wrong answer | 8ms | 5420 KiB | ||||
32 | Wrong answer | 8ms | 5492 KiB | ||||
subtask6 | 0/50 | ||||||
33 | Accepted | 18ms | 9300 KiB | ||||
34 | Accepted | 193ms | 51376 KiB | ||||
35 | Wrong answer | 1.052s | 39192 KiB | ||||
36 | Wrong answer | 1.088s | 42424 KiB | ||||
37 | Wrong answer | 1.72s | 236888 KiB | ||||
38 | Wrong answer | 1.659s | 262388 KiB | ||||
39 | Wrong answer | 1.8s | 291500 KiB | ||||
40 | Wrong answer | 1.827s | 268088 KiB | ||||
41 | Accepted | 1.613s | 108532 KiB |