Submission #3609892
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct edge{
int to;
int cost;
};
int N,M;
vector< edge > G[100005];
int main(){
cin>>N>>M;
for(int i=0;i<M;i++){
int from,to,cost;
cin>>from>>to>>cost;
from--,to--;
G[from].push_back((edge){to,cost});
G[to].push_back((edge){from,cost});
}
ll ans=0;
for(int i=0;i<N;i++){
map<ll,ll> mp;
for(edge e:G[i]){
ans += mp[ 2540 - e.cost ];
mp[ e.cost ]++;
}
}
cout<<ans<<endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - 2540 |
| User | dohatsutsu |
| Language | C++14 (GCC 5.4.1) |
| Score | 300 |
| Code Size | 550 Byte |
| Status | AC |
| Exec Time | 125 ms |
| Memory | 6644 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, sample_01.txt, sample_02.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | AC | 118 ms | 6644 KiB |
| 02.txt | AC | 113 ms | 4480 KiB |
| 03.txt | AC | 71 ms | 4480 KiB |
| 04.txt | AC | 72 ms | 4480 KiB |
| 05.txt | AC | 125 ms | 6272 KiB |
| 06.txt | AC | 100 ms | 5888 KiB |
| 07.txt | AC | 61 ms | 5760 KiB |
| 08.txt | AC | 2 ms | 2560 KiB |
| 09.txt | AC | 76 ms | 5632 KiB |
| sample_01.txt | AC | 2 ms | 2560 KiB |
| sample_02.txt | AC | 2 ms | 2560 KiB |