27462023-01-20 18:51:48CattVarázserdőcpp17Wrong answer 0/1001.916s291944 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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1816 KiB
2Wrong answer2ms2048 KiB
3Accepted2ms2296 KiB
subtask20/7
4Wrong answer2ms2520 KiB
5Wrong answer3ms2876 KiB
6Wrong answer16ms6488 KiB
7Wrong answer17ms7240 KiB
8Wrong answer1.162s244112 KiB
9Wrong answer1.062s230772 KiB
10Wrong answer859ms217072 KiB
11Wrong answer893ms207072 KiB
12Wrong answer783ms203020 KiB
13Wrong answer777ms202564 KiB
subtask30/9
14Accepted3ms3700 KiB
15Accepted3ms4060 KiB
16Accepted146ms38312 KiB
17Wrong answer669ms61620 KiB
18Wrong answer1.889s230544 KiB
19Wrong answer1.284s175908 KiB
20Wrong answer1.294s181216 KiB
subtask40/14
21Wrong answer2ms4240 KiB
22Wrong answer2ms4252 KiB
23Wrong answer2ms4380 KiB
24Wrong answer2ms4452 KiB
subtask50/20
25Accepted3ms4812 KiB
26Wrong answer8ms6148 KiB
27Wrong answer8ms5604 KiB
28Wrong answer8ms6460 KiB
29Wrong answer8ms6372 KiB
30Wrong answer8ms6192 KiB
31Wrong answer8ms5964 KiB
32Wrong answer7ms6036 KiB
subtask60/50
33Accepted17ms9328 KiB
34Accepted193ms51820 KiB
35Wrong answer1.049s39556 KiB
36Wrong answer1.093s42804 KiB
37Wrong answer1.677s237292 KiB
38Wrong answer1.916s262704 KiB
39Wrong answer1.807s291944 KiB
40Wrong answer1.623s268552 KiB
41Wrong answer1.455s109340 KiB