# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
467939 | 2021-08-25T16:20:43 Z | czhang2718 | timeismoney (balkan11_timeismoney) | C++14 | 3 ms | 380 KB |
#include "bits/stdc++.h" using namespace std; int n, m; const int N=200; int par[N]; vector<pair<int, pair<int, int>>> edges; int find(int x){ if(par[x]==x) return x; return par[x]=find(par[x]); } bool join(int x, int y){ if(find(x)==find(y)) return 0; par[find(x)]=find(y); return 1; } int main(){ cin.tie(0)->sync_with_stdio(0); freopen("timeismoney.in", "r", stdin); freopen("timeismoney.out", "w", stdout); cin >> n >> m; for(int i=0; i<n; i++) par[i]=i; for(int i=0; i<m; i++){ int u, v, c, t; cin >> u >> v >> c >> t; edges.push_back({c, {u, v}}); } int ans=0; sort(edges.begin(), edges.end()); for(auto p:edges){ int u=p.second.first; int v=p.second.second; if(join(u, v)) ans+=p.first; } cout << ans*ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |
2 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |
3 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |
4 | Incorrect | 3 ms | 332 KB | Unexpected end of file - int64 expected |
5 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |
6 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |
7 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |
8 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |
9 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |
10 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |
11 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |
12 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |
13 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |
14 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |
15 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |
16 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |
17 | Incorrect | 2 ms | 380 KB | Unexpected end of file - int64 expected |
18 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |
19 | Incorrect | 2 ms | 376 KB | Unexpected end of file - int64 expected |
20 | Incorrect | 2 ms | 332 KB | Unexpected end of file - int64 expected |