2748 | 2023-01-20 18:55:18 | Catt | Varázserdő | cpp17 | Wrong answer 21/100 | 2.161s | 387232 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n,m;
cin >> n >> m;
vector<pair<ll, pair<ll, ll>> > g(m);
for(ll i = 0; i < m; i++) {
ll x,y,z;
cin >> x >> y >> z;
g[i] = {z, {x, y}};
}
vector<map<ll, ll> > v(n+1);
ll mo = 0;
sort(g.begin(), g.end());
for(ll i = 0; i < m; i++) {
ll 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 | 1808 KiB | ||||
2 | Accepted | 2ms | 2056 KiB | ||||
3 | Accepted | 2ms | 2136 KiB | ||||
subtask2 | 7/7 | ||||||
4 | Accepted | 2ms | 2292 KiB | ||||
5 | Accepted | 3ms | 2988 KiB | ||||
6 | Accepted | 14ms | 7764 KiB | ||||
7 | Accepted | 16ms | 8956 KiB | ||||
8 | Accepted | 1s | 316740 KiB | ||||
9 | Accepted | 952ms | 298624 KiB | ||||
10 | Accepted | 1.019s | 280300 KiB | ||||
11 | Accepted | 848ms | 267376 KiB | ||||
12 | Accepted | 824ms | 261728 KiB | ||||
13 | Accepted | 816ms | 261208 KiB | ||||
subtask3 | 0/9 | ||||||
14 | Accepted | 2ms | 3528 KiB | ||||
15 | Accepted | 3ms | 3864 KiB | ||||
16 | Accepted | 155ms | 48160 KiB | ||||
17 | Accepted | 736ms | 85348 KiB | ||||
18 | Accepted | 1.922s | 305956 KiB | ||||
19 | Wrong answer | 1.328s | 233116 KiB | ||||
20 | Wrong answer | 1.225s | 240212 KiB | ||||
subtask4 | 14/14 | ||||||
21 | Accepted | 2ms | 4220 KiB | ||||
22 | Accepted | 2ms | 4224 KiB | ||||
23 | Accepted | 2ms | 4220 KiB | ||||
24 | Accepted | 2ms | 4348 KiB | ||||
subtask5 | 0/20 | ||||||
25 | Accepted | 3ms | 4984 KiB | ||||
26 | Accepted | 8ms | 6532 KiB | ||||
27 | Accepted | 8ms | 5796 KiB | ||||
28 | Accepted | 9ms | 7024 KiB | ||||
29 | Accepted | 8ms | 6928 KiB | ||||
30 | Accepted | 8ms | 6816 KiB | ||||
31 | Wrong answer | 8ms | 5984 KiB | ||||
32 | Wrong answer | 8ms | 5984 KiB | ||||
subtask6 | 0/50 | ||||||
33 | Accepted | 17ms | 10560 KiB | ||||
34 | Accepted | 207ms | 65648 KiB | ||||
35 | Wrong answer | 1.08s | 66064 KiB | ||||
36 | Wrong answer | 1.121s | 70436 KiB | ||||
37 | Wrong answer | 1.59s | 314124 KiB | ||||
38 | Wrong answer | 1.983s | 348388 KiB | ||||
39 | Wrong answer | 2.161s | 387232 KiB | ||||
40 | Wrong answer | 1.687s | 355940 KiB | ||||
41 | Accepted | 1.542s | 156052 KiB |